Documentation
¶
Overview ¶
Package cmd implements the CobraCLI commands for the gitlabctl CLI. Subcommands for the CLI should all live within this package. Logic should be delegated to internal packages and functions to keep the CLI commands clean and focused on CLI I/O.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gitlabctl ¶
type Gitlabctl struct { Version string RootFlags config.RootFlags OutputConfig writer.OutputConfig OutputSignal signal.Signal RootCmd *cobra.Command VersionCmd *cobra.Command ProjectsCmd *cobra.Command VulnerabilityCmd *cobra.Command GitlabClient *gitlab.Client }
Gitlabctl is the main struct for the gitlabctl CLI. It contains the version, root flags, output config, output signal, information, providing a context for subcommands to leverage during execution. The output signal is used to write the output of the command to the desired output format and location.
func NewGitlabctl ¶
NewGitlabctl creates a new Gitlabctl struct with the provided version. The root flags, output config, and output format. We pass the version in here from our main.go file, where we set the version string during the build process.
func (*Gitlabctl) InitProjectsCmd ¶
func (a *Gitlabctl) InitProjectsCmd()
InitProjectsCmd initializes the projects command for the gitlabctl CLI. This command sets up the flags for the command, parsing the provided group ID, archived, and mine flags before passing them to the projects package for enumeration.
func (*Gitlabctl) InitRootCommand ¶
func (a *Gitlabctl) InitRootCommand()
InitRootCommand initializes the root command for the gitlabctl CLI. This command sets up the persistent flags for the CLI, including the quiet, verbose, base-url, token, output-file, and output flags. The root command also sets up the version command, which prints the version of the gitlabctl CLI. The root command sets the PersistentPreRunE, which is responsible for initializing the output signal, as well as creating the Gitlab client that will be used in all commands. The PersistentPostRunE is responsible for writing the output of the command to the desired output format and location.
func (*Gitlabctl) InitVulnerabilityCmd ¶
func (a *Gitlabctl) InitVulnerabilityCmd()
InitVulnerabilityCmd initializes the vulnerability command for the gitlabctl CLI. This command sets up the flags for the command, parsing the provided state and severity filters before passing them to the vulnerability package for enumeration.