Documentation
¶
Overview ¶
Package cmdutil provides utilities that are shared between multiple commands like flags, documentation helpers and errors.
Index ¶
- func AddOutputFlag(cmd *cobra.Command, p *string, allowedValues ...string)
- func AddRepositoryFlag(cmd *cobra.Command, f *Factory, p *[]string)
- func ExactNonEmptyArgs(n int) cobra.PositionalArgs
- func Examples(s string) string
- func GitignoreNames(f *Factory) []string
- func LicenseNames(f *Factory) []string
- func LogLevelNames() []string
- func LongDesc(s string) string
- func RenderJSON(w io.Writer, v interface{}) error
- func RenderYAML(w io.Writer, v interface{}) error
- func RepositoryNames(f *Factory) []string
- func SkeletonFilenames(f *Factory, skeletonName string, repoNames ...string) []string
- func SkeletonNames(f *Factory, repoNames ...string) []string
- type Factory
- type RepositoryAlreadyExistsError
- type RepositoryNotConfiguredError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddOutputFlag ¶ added in v0.2.0
AddOutputFlag adds the --output flag to cmd and binds it to p. The first value from allowedValues is set as the default. Panics if allowedValues is empty.
func AddRepositoryFlag ¶ added in v0.2.0
AddRepositoryFlag adds the --repository flag to cmd and binds it to p.
func ExactNonEmptyArgs ¶ added in v0.2.0
func ExactNonEmptyArgs(n int) cobra.PositionalArgs
ExactNonEmptyArgs returns an error if there are not exactly n args or if any of them is an empty string.
func Examples ¶
Examples formats examples for a *cobra.Command. Each line is indented by 2 spaces so that it aligns nicely with usage and flags.
func GitignoreNames ¶ added in v0.2.0
GitignoreNames compiles a sorted list of gitignore template names. Used for completion.
func LicenseNames ¶ added in v0.2.0
LicenseNames compiles a sorted list of license names. Used for completion.
func LogLevelNames ¶ added in v0.2.0
func LogLevelNames() []string
LogLevelNames compiles a list of log level names. Used for completion.
func RenderJSON ¶
RenderJSON converts v to JSON and writes it to w.
func RenderYAML ¶
RenderYAML converts v to YAML and writes it to w.
func RepositoryNames ¶ added in v0.2.0
RepositoryNames compiles a sorted list of repository names from the config. Used for completion.
func SkeletonFilenames ¶ added in v0.2.0
SkeletonFilenames compiles a sorted list of skeleton file names from the configured repositories. Used for completion.
func SkeletonNames ¶ added in v0.2.0
SkeletonNames compiles a sorted list of skeleton names from the configured repositories. Used for completion.
Types ¶
type Factory ¶ added in v0.2.0
type Factory struct {
IOStreams cli.IOStreams
ConfigPath string
Config func() (*kickoff.Config, error)
GitClient func() git.Client
HTTPClient func() *http.Client
Repository func(...string) (kickoff.Repository, error)
Prompt prompt.Prompt
}
Factory can create instances of commonly needed datastructures like config, repository and http client.
func NewFactory ¶ added in v0.2.0
NewFactory creates the default *Factory that is passed to commands.
type RepositoryAlreadyExistsError ¶ added in v0.2.0
type RepositoryAlreadyExistsError string
func (RepositoryAlreadyExistsError) Error ¶ added in v0.2.0
func (e RepositoryAlreadyExistsError) Error() string
Error implements the error interface.
type RepositoryNotConfiguredError ¶ added in v0.1.1
type RepositoryNotConfiguredError string
func (RepositoryNotConfiguredError) Error ¶ added in v0.1.1
func (e RepositoryNotConfiguredError) Error() string
Error implements the error interface.