github.com/jfrog/jfrog-cli-core/v2@v2.52.0/plugins/components/structure.go (about)

     1  package components
     2  
     3  type App struct {
     4  	Version string
     5  	Namespace
     6  	Subcommands []Namespace
     7  }
     8  
     9  func CreateApp(name, version, description string, commands []Command) App {
    10  	return App{
    11  		Version: version,
    12  		Namespace: Namespace{
    13  			Name:        name,
    14  			Description: description,
    15  			Commands:    commands,
    16  		},
    17  	}
    18  }
    19  
    20  func CreateEmbeddedApp(name string, commands []Command, namespaces ...Namespace) App {
    21  	app := App{
    22  		Namespace: Namespace{
    23  			Name:     name,
    24  			Commands: commands,
    25  		},
    26  	}
    27  	app.Subcommands = append(app.Subcommands, namespaces...)
    28  	return app
    29  }
    30  
    31  type Namespace struct {
    32  	Name        string
    33  	Description string
    34  	Category    string
    35  	Commands    []Command
    36  }
    37  
    38  type Command struct {
    39  	Name            string
    40  	Description     string
    41  	Category        string
    42  	Aliases         []string
    43  	UsageOptions    *UsageOptions
    44  	Arguments       []Argument
    45  	Flags           []Flag
    46  	EnvVars         []EnvVar
    47  	Action          ActionFunc
    48  	SkipFlagParsing bool
    49  	Hidden          bool
    50  }
    51  
    52  type UsageOptions struct {
    53  	// Special cases, each of these will be created as command usage option and the value appended as suffix for the command name.
    54  	Usage []string
    55  	// If true then the given usages will replace the auto generated usage. Otherwise the given usages will be appended to the auto generated usage.
    56  	ReplaceAutoGeneratedUsage bool
    57  }
    58  
    59  type PluginSignature struct {
    60  	Name  string `json:"name,omitempty"`
    61  	Usage string `json:"usage,omitempty"`
    62  	// Only used internally in the CLI.
    63  	ExecutablePath string `json:"executablePath,omitempty"`
    64  }