Skip to content

Commit

Permalink
Add positional arguments to CLI usage
Browse files Browse the repository at this point in the history
Positional arguments like the machine name or provider name are
undocumented in the CLI. This commit adds them to the "Use" string so
that they show up with the --help flag.
  • Loading branch information
lentzi90 authored and pascalbreuninger committed Dec 11, 2024
1 parent ad90c16 commit 87c59f2
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions cmd/machine/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ type CreateCmd struct {
ProviderOptions []string
}

// NewCreateCmd creates a new destroy command
// NewCreateCmd creates a new create command
func NewCreateCmd(flags *flags.GlobalFlags) *cobra.Command {
cmd := &CreateCmd{
GlobalFlags: flags,
}
createCmd := &cobra.Command{
Use: "create",
Use: "create [name]",
Short: "Creates a new machine",
RunE: func(_ *cobra.Command, args []string) error {
return cmd.Run(context.Background(), args)
Expand Down
2 changes: 1 addition & 1 deletion cmd/machine/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func NewDeleteCmd(flags *flags.GlobalFlags) *cobra.Command {
GlobalFlags: flags,
}
deleteCmd := &cobra.Command{
Use: "delete",
Use: "delete [name]",
Short: "Deletes an existing machine",
RunE: func(_ *cobra.Command, args []string) error {
return cmd.Run(context.Background(), args)
Expand Down
2 changes: 1 addition & 1 deletion cmd/machine/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func NewSSHCmd(flags *flags.GlobalFlags) *cobra.Command {
GlobalFlags: flags,
}
sshCmd := &cobra.Command{
Use: "ssh",
Use: "ssh [name]",
Short: "SSH into the machine",
RunE: func(c *cobra.Command, args []string) error {
return cmd.Run(context.Background(), args)
Expand Down
2 changes: 1 addition & 1 deletion cmd/machine/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func NewStartCmd(flags *flags.GlobalFlags) *cobra.Command {
GlobalFlags: flags,
}
startCmd := &cobra.Command{
Use: "start",
Use: "start [name]",
Short: "Starts an existing machine",
RunE: func(_ *cobra.Command, args []string) error {
return cmd.Run(context.Background(), args)
Expand Down
2 changes: 1 addition & 1 deletion cmd/machine/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func NewStatusCmd(flags *flags.GlobalFlags) *cobra.Command {
GlobalFlags: flags,
}
statusCmd := &cobra.Command{
Use: "status",
Use: "status [name]",
Short: "Retrieves the status of an existing machine",
RunE: func(_ *cobra.Command, args []string) error {
return cmd.Run(context.Background(), args)
Expand Down
2 changes: 1 addition & 1 deletion cmd/machine/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func NewStopCmd(flags *flags.GlobalFlags) *cobra.Command {
GlobalFlags: flags,
}
stopCmd := &cobra.Command{
Use: "stop",
Use: "stop [name]",
Short: "Stops an existing machine",
RunE: func(_ *cobra.Command, args []string) error {
return cmd.Run(context.Background(), args)
Expand Down
2 changes: 1 addition & 1 deletion cmd/provider/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func NewAddCmd(flags *flags.GlobalFlags) *cobra.Command {
GlobalFlags: flags,
}
addCmd := &cobra.Command{
Use: "add",
Use: "add [URL or path]",
Short: "Adds a new provider to DevPod",
PreRunE: func(cobraCommand *cobra.Command, args []string) error {
if cmd.FromExisting != "" {
Expand Down
2 changes: 1 addition & 1 deletion cmd/provider/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func NewDeleteCmd(flags *flags.GlobalFlags) *cobra.Command {
GlobalFlags: flags,
}
deleteCmd := &cobra.Command{
Use: "delete",
Use: "delete [name]",
Short: "Delete a provider",
RunE: func(_ *cobra.Command, args []string) error {
return cmd.Run(context.Background(), args)
Expand Down
2 changes: 1 addition & 1 deletion cmd/provider/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func NewUpdateCmd(flags *flags.GlobalFlags) *cobra.Command {
GlobalFlags: flags,
}
updateCmd := &cobra.Command{
Use: "update",
Use: "update [name] [URL or path]",
Short: "Updates a provider in DevPod",
RunE: func(_ *cobra.Command, args []string) error {
ctx := context.Background()
Expand Down
2 changes: 1 addition & 1 deletion cmd/provider/use.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func NewUseCmd(flags *flags.GlobalFlags) *cobra.Command {
GlobalFlags: *flags,
}
useCmd := &cobra.Command{
Use: "use",
Use: "use [name]",
Short: "Configure an existing provider and set as default",
RunE: func(_ *cobra.Command, args []string) error {
if len(args) != 1 {
Expand Down

0 comments on commit 87c59f2

Please sign in to comment.