Skip to content

Commit

Permalink
reorder usage strings
Browse files Browse the repository at this point in the history
  • Loading branch information
phm07 committed Mar 13, 2024
1 parent d741b58 commit 4ffc625
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ Command usage descriptions (namely `cobra.Command.Use`) should follow the [docop
Additionally:
- Optional flags should be the first in the usage string.
- If there is more than one optional flag, you can use `[options]` to abbreviate.
- Required flags should always be documented explicitly and after the positional arguments.
- Required flags should always be documented explicitly and before the positional arguments, but after the
optional flags.

### Subcommand groups

Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/base/set_rdns.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type SetRdnsCmd struct {
// CobraCommand creates a command that can be registered with cobra.
func (rc *SetRdnsCmd) CobraCommand(s state.State) *cobra.Command {
cmd := &cobra.Command{
Use: fmt.Sprintf("set-rdns [options] <%s> --hostname <hostname>", strings.ToLower(rc.ResourceNameSingular)),
Use: fmt.Sprintf("set-rdns [options] --hostname <hostname> <%s>", strings.ToLower(rc.ResourceNameSingular)),
Short: rc.ShortDescription,
Args: cobra.ExactArgs(1),
ValidArgsFunction: cmpl.SuggestArgs(cmpl.SuggestCandidatesF(rc.NameSuggestions(s.Client()))),
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/server/add_to_placement_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
var AddToPlacementGroupCmd = base.Cmd{
BaseCobraCommand: func(client hcapi2.Client) *cobra.Command {
cmd := &cobra.Command{
Use: "add-to-placement-group <server> --placement-group <placement-group>",
Use: "add-to-placement-group --placement-group <placement-group> <server>",
Short: "Add a server to a placement group",
Args: cobra.ExactArgs(1),
ValidArgsFunction: cmpl.SuggestArgs(cmpl.SuggestCandidatesF(client.Server().Names)),
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/server/attach_to_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
var AttachToNetworkCmd = base.Cmd{
BaseCobraCommand: func(client hcapi2.Client) *cobra.Command {
cmd := &cobra.Command{
Use: "attach-to-network [options] <server> --network <network>",
Use: "attach-to-network [options] --network <network> <server>",
Short: "Attach a server to a network",
Args: cobra.ExactArgs(1),
ValidArgsFunction: cmpl.SuggestArgs(cmpl.SuggestCandidatesF(client.Server().Names)),
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/server/change_alias_ips.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
var ChangeAliasIPsCmd = base.Cmd{
BaseCobraCommand: func(client hcapi2.Client) *cobra.Command {
cmd := &cobra.Command{
Use: "change-alias-ips [options] <server> --network <network>",
Use: "change-alias-ips [options] --network <network> <server>",
Short: "Change a server's alias IPs in a network",
Args: cobra.ExactArgs(1),
ValidArgsFunction: cmpl.SuggestArgs(cmpl.SuggestCandidatesF(client.Server().Names)),
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/server/create_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
var CreateImageCmd = base.Cmd{
BaseCobraCommand: func(client hcapi2.Client) *cobra.Command {
cmd := &cobra.Command{
Use: "create-image [options] <server> --type <snapshot|backup>",
Use: "create-image [options] --type <snapshot|backup> <server>",
Short: "Create an image from a server",
Args: cobra.ExactArgs(1),
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/server/detach_from_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
var DetachFromNetworkCmd = base.Cmd{
BaseCobraCommand: func(client hcapi2.Client) *cobra.Command {
cmd := &cobra.Command{
Use: "detach-from-network <server> --network <network>",
Use: "detach-from-network --network <network> <server>",
Short: "Detach a server from a network",
Args: cobra.ExactArgs(1),
ValidArgsFunction: cmpl.SuggestArgs(cmpl.SuggestCandidatesF(client.Server().Names)),
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/server/rebuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
var RebuildCmd = base.Cmd{
BaseCobraCommand: func(client hcapi2.Client) *cobra.Command {
cmd := &cobra.Command{
Use: "rebuild [--allow-deprecated-image] <server> --image <image>",
Use: "rebuild [--allow-deprecated-image] --image <image> <server>",
Short: "Rebuild a server",
Args: cobra.ExactArgs(1),
ValidArgsFunction: cmpl.SuggestArgs(cmpl.SuggestCandidatesF(client.Server().Names)),
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/volume/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
var AttachCmd = base.Cmd{
BaseCobraCommand: func(client hcapi2.Client) *cobra.Command {
cmd := &cobra.Command{
Use: "attach [--automount] <volume> --server <server>",
Use: "attach [--automount] --server <server> <volume>",
Short: "Attach a volume to a server",
Args: cobra.ExactArgs(1),
ValidArgsFunction: cmpl.SuggestArgs(cmpl.SuggestCandidatesF(client.Volume().Names)),
Expand Down

0 comments on commit 4ffc625

Please # to comment.