Skip to content

Commit

Permalink
Add (required) to help text of all required lags (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
LKaemmerling authored Jul 17, 2020
1 parent 03c3c82 commit 8245b2f
Show file tree
Hide file tree
Showing 25 changed files with 35 additions and 34 deletions.
6 changes: 3 additions & 3 deletions cli/certificate_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ func newCertificateCreateCommand(cli *CLI) *cobra.Command {
RunE: cli.wrap(runCertificateCreate),
}

cmd.Flags().String("name", "", "Certificate name")
cmd.Flags().String("name", "", "Certificate name (required)")
cmd.MarkFlagRequired("name")

cmd.Flags().String("cert-file", "", "File containing the PEM encoded certificate")
cmd.Flags().String("cert-file", "", "File containing the PEM encoded certificate (required)")
cmd.MarkFlagRequired("cert-file")

cmd.Flags().String("key-file", "", "File containing the PEM encoded private key for the certificate")
cmd.Flags().String("key-file", "", "File containing the PEM encoded private key for the certificate (required)")
cmd.MarkFlagRequired("key-file")

return cmd
Expand Down
2 changes: 1 addition & 1 deletion cli/floatingip_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func newFloatingIPCreateCommand(cli *CLI) *cobra.Command {
PreRunE: chainRunE(validateFloatingIPCreate, cli.ensureToken),
RunE: cli.wrap(runFloatingIPCreate),
}
cmd.Flags().String("type", "", "Type (ipv4 or ipv6)")
cmd.Flags().String("type", "", "Type (ipv4 or ipv6) (required)")
cmd.Flag("type").Annotations = map[string][]string{
cobra.BashCompCustom: {"__hcloud_floatingip_types"},
}
Expand Down
2 changes: 1 addition & 1 deletion cli/floatingip_set_rdns.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func newFloatingIPSetRDNSCommand(cli *CLI) *cobra.Command {
RunE: cli.wrap(runFloatingIPSetRDNS),
}

cmd.Flags().StringP("hostname", "r", "", "Hostname to set as a reverse DNS PTR entry")
cmd.Flags().StringP("hostname", "r", "", "Hostname to set as a reverse DNS PTR entry (required)")
cmd.MarkFlagRequired("hostname")

cmd.Flags().StringP("ip", "i", "", "IP address for which the reverse DNS entry should be set")
Expand Down
2 changes: 1 addition & 1 deletion cli/load_balancer_add_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func newLoadBalancerAddServiceCommand(cli *CLI) *cobra.Command {
PreRunE: chainRunE(validateLoadBalancerAddService, cli.ensureToken),
RunE: cli.wrap(runLoadBalancerAddService),
}
cmd.Flags().String("protocol", "", "Protocol of the service")
cmd.Flags().String("protocol", "", "Protocol of the service (required)")
cmd.MarkFlagRequired("protocol")

cmd.Flags().Int("listen-port", 0, "Listen port of the service")
Expand Down
2 changes: 1 addition & 1 deletion cli/load_balancer_attach_to_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func newLoadBalancerAttachToNetworkCommand(cli *CLI) *cobra.Command {
RunE: cli.wrap(runLoadBalancerAttachToNetwork),
}

cmd.Flags().StringP("network", "n", "", "Network (ID or name)")
cmd.Flags().StringP("network", "n", "", "Network (ID or name) (required)")
cmd.Flag("network").Annotations = map[string][]string{
cobra.BashCompCustom: {"__hcloud_network_names"},
}
Expand Down
4 changes: 2 additions & 2 deletions cli/load_balancer_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ func newLoadBalancerCreateCommand(cli *CLI) *cobra.Command {
RunE: cli.wrap(runLoadBalancerCreate),
}

cmd.Flags().String("name", "", "Load Balancer name")
cmd.Flags().String("name", "", "Load Balancer name (required)")
cmd.MarkFlagRequired("name")

cmd.Flags().String("type", "", "Load Balancer type (ID or name)")
cmd.Flags().String("type", "", "Load Balancer type (ID or name) (required)")
cmd.Flag("type").Annotations = map[string][]string{
cobra.BashCompCustom: {"__hcloud_load_balancer_type_names"},
}
Expand Down
2 changes: 1 addition & 1 deletion cli/load_balancer_delete_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func newLoadBalancerDeleteServiceCommand(cli *CLI) *cobra.Command {
RunE: cli.wrap(runLoadBalancerDeleteService),
}

cmd.Flags().Int("listen-port", 0, "The listen port of the service you want to delete")
cmd.Flags().Int("listen-port", 0, "The listen port of the service you want to delete (required)")
cmd.MarkFlagRequired("listen-port")
return cmd
}
Expand Down
2 changes: 1 addition & 1 deletion cli/load_balancer_detach_from_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func newLoadBalancerDetachFromNetworkCommand(cli *CLI) *cobra.Command {
PreRunE: cli.ensureToken,
RunE: cli.wrap(runLoadBalancerDetachFromNetwork),
}
cmd.Flags().StringP("network", "n", "", "Network (ID or name)")
cmd.Flags().StringP("network", "n", "", "Network (ID or name) (required)")
cmd.Flag("network").Annotations = map[string][]string{
cobra.BashCompCustom: {"__hcloud_network_names"},
}
Expand Down
2 changes: 1 addition & 1 deletion cli/load_balancer_update_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func newLoadBalancerUpdateServiceCommand(cli *CLI) *cobra.Command {
RunE: cli.wrap(runLoadBalancerUpdateService),
}

cmd.Flags().Int("listen-port", 0, "The listen port of the service that you want to update")
cmd.Flags().Int("listen-port", 0, "The listen port of the service that you want to update (required)")
cmd.MarkFlagRequired("listen-port")

cmd.Flags().Int("destination-port", 0, "Destination port of the service on the targets")
Expand Down
4 changes: 2 additions & 2 deletions cli/network_add_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ func newNetworkAddRouteCommand(cli *CLI) *cobra.Command {
RunE: cli.wrap(runNetworkAddRoute),
}

cmd.Flags().IPNet("destination", net.IPNet{}, "Destination network or host")
cmd.Flags().IPNet("destination", net.IPNet{}, "Destination network or host (required)")
cmd.MarkFlagRequired("destination")

cmd.Flags().IP("gateway", net.IP{}, "Gateway IP address")
cmd.Flags().IP("gateway", net.IP{}, "Gateway IP address (required)")
cmd.MarkFlagRequired("gateway")

return cmd
Expand Down
2 changes: 1 addition & 1 deletion cli/network_change_ip_range.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func newNetworkChangeIPRangeCommand(cli *CLI) *cobra.Command {
RunE: cli.wrap(runNetworkChangeIPRange),
}

cmd.Flags().IPNet("ip-range", net.IPNet{}, "New IP range")
cmd.Flags().IPNet("ip-range", net.IPNet{}, "New IP range (required)")
cmd.MarkFlagRequired("ip-range")

return cmd
Expand Down
4 changes: 2 additions & 2 deletions cli/network_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ func newNetworkCreateCommand(cli *CLI) *cobra.Command {
RunE: cli.wrap(runNetworkCreate),
}

cmd.Flags().String("name", "", "Network name")
cmd.Flags().String("name", "", "Network name (required)")
cmd.MarkFlagRequired("name")

cmd.Flags().IPNet("ip-range", net.IPNet{}, "Network IP range")
cmd.Flags().IPNet("ip-range", net.IPNet{}, "Network IP range (required)")
cmd.MarkFlagRequired("ip-range")

cmd.Flags().StringToString("label", nil, "User-defined labels ('key=value') (can be specified multiple times)")
Expand Down
4 changes: 2 additions & 2 deletions cli/network_remove_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ func newNetworkRemoveRouteCommand(cli *CLI) *cobra.Command {
RunE: cli.wrap(runNetworkRemoveRoute),
}

cmd.Flags().IPNet("destination", net.IPNet{}, "Destination network or host")
cmd.Flags().IPNet("destination", net.IPNet{}, "Destination network or host (required)")
cmd.MarkFlagRequired("destination")

cmd.Flags().IP("gateway", net.IP{}, "Gateway IP address")
cmd.Flags().IP("gateway", net.IP{}, "Gateway IP address (required)")
cmd.MarkFlagRequired("gateway")

return cmd
Expand Down
2 changes: 1 addition & 1 deletion cli/network_remove_subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func newNetworkRemoveSubnetCommand(cli *CLI) *cobra.Command {
PreRunE: cli.ensureToken,
RunE: cli.wrap(runNetworkRemoveSubnet),
}
cmd.Flags().IPNet("ip-range", net.IPNet{}, "Subnet IP range")
cmd.Flags().IPNet("ip-range", net.IPNet{}, "Subnet IP range (required)")
cmd.MarkFlagRequired("ip-range")
return cmd
}
Expand Down
2 changes: 1 addition & 1 deletion cli/server_attach_to_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func newServerAttachToNetworkCommand(cli *CLI) *cobra.Command {
RunE: cli.wrap(runServerAttachToNetwork),
}

cmd.Flags().StringP("network", "n", "", "Network (ID or name)")
cmd.Flags().StringP("network", "n", "", "Network (ID or name) (required)")
cmd.Flag("network").Annotations = map[string][]string{
cobra.BashCompCustom: {"__hcloud_network_names"},
}
Expand Down
2 changes: 1 addition & 1 deletion cli/server_change_alias_ips.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func newServerChangeAliasIPsCommand(cli *CLI) *cobra.Command {
RunE: cli.wrap(runServerChangeAliasIPsk),
}

cmd.Flags().StringP("network", "n", "", "Network (ID or name)")
cmd.Flags().StringP("network", "n", "", "Network (ID or name) (required)")
cmd.Flag("network").Annotations = map[string][]string{
cobra.BashCompCustom: {"__hcloud_network_names"},
}
Expand Down
6 changes: 3 additions & 3 deletions cli/server_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ func newServerCreateCommand(cli *CLI) *cobra.Command {
PreRunE: cli.ensureToken,
RunE: cli.wrap(runServerCreate),
}
cmd.Flags().String("name", "", "Server name")
cmd.Flags().String("name", "", "Server name (required)")
cmd.MarkFlagRequired("name")

cmd.Flags().String("type", "", "Server type (ID or name)")
cmd.Flags().String("type", "", "Server type (ID or name) (required)")
cmd.Flag("type").Annotations = map[string][]string{
cobra.BashCompCustom: {"__hcloud_servertype_names"},
}
cmd.MarkFlagRequired("type")

cmd.Flags().String("image", "", "Image (ID or name)")
cmd.Flags().String("image", "", "Image (ID or name) (required)")
cmd.Flag("image").Annotations = map[string][]string{
cobra.BashCompCustom: {"__hcloud_image_names"},
}
Expand Down
2 changes: 1 addition & 1 deletion cli/server_create_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func newServerCreateImageCommand(cli *CLI) *cobra.Command {
PreRunE: chainRunE(validateServerCreateImage, cli.ensureToken),
RunE: cli.wrap(runServerCreateImage),
}
cmd.Flags().String("type", "", "Image type")
cmd.Flags().String("type", "", "Image type (required)")
cmd.Flag("type").Annotations = map[string][]string{
cobra.BashCompCustom: {"__hcloud_image_types_no_system"},
}
Expand Down
2 changes: 1 addition & 1 deletion cli/server_detach_from_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func newServerDetachFromNetworkCommand(cli *CLI) *cobra.Command {
PreRunE: cli.ensureToken,
RunE: cli.wrap(runServerDetachFromNetwork),
}
cmd.Flags().StringP("network", "n", "", "Network (ID or name)")
cmd.Flags().StringP("network", "n", "", "Network (ID or name) (required)")
cmd.Flag("network").Annotations = map[string][]string{
cobra.BashCompCustom: {"__hcloud_network_names"},
}
Expand Down
2 changes: 1 addition & 1 deletion cli/server_rebuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func newServerRebuildCommand(cli *CLI) *cobra.Command {
RunE: cli.wrap(runServerRebuild),
}

cmd.Flags().String("image", "", "ID or name of image to rebuild from")
cmd.Flags().String("image", "", "ID or name of image to rebuild from (required)")
cmd.Flag("image").Annotations = map[string][]string{
cobra.BashCompCustom: {"__hcloud_image_names"},
}
Expand Down
2 changes: 1 addition & 1 deletion cli/server_set_rdns.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func newServerSetRDNSCommand(cli *CLI) *cobra.Command {
RunE: cli.wrap(runServerSetRDNS),
}

cmd.Flags().StringP("hostname", "r", "", "Hostname to set as a reverse DNS PTR entry")
cmd.Flags().StringP("hostname", "r", "", "Hostname to set as a reverse DNS PTR entry (required)")
cmd.MarkFlagRequired("hostname")

cmd.Flags().StringP("ip", "i", "", "IP address for which the reverse DNS entry should be set")
Expand Down
2 changes: 1 addition & 1 deletion cli/sshkey_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func newSSHKeyCreateCommand(cli *CLI) *cobra.Command {
PreRunE: chainRunE(validateSSHKeyCreate, cli.ensureToken),
RunE: cli.wrap(runSSHKeyCreate),
}
cmd.Flags().String("name", "", "Key name")
cmd.Flags().String("name", "", "Key name (required)")
cmd.Flags().String("public-key", "", "Public key")
cmd.Flags().String("public-key-from-file", "", "Path to file containing public key")
cmd.Flags().StringToString("label", nil, "User-defined labels ('key=value') (can be specified multiple times)")
Expand Down
2 changes: 1 addition & 1 deletion cli/volume_attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func newVolumeAttachCommand(cli *CLI) *cobra.Command {
PreRunE: cli.ensureToken,
RunE: cli.wrap(runVolumeAttach),
}
cmd.Flags().String("server", "", "Server (ID or name)")
cmd.Flags().String("server", "", "Server (ID or name) (required)")
cmd.Flag("server").Annotations = map[string][]string{
cobra.BashCompCustom: {"__hcloud_server_names"},
}
Expand Down
4 changes: 2 additions & 2 deletions cli/volume_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func newVolumeCreateCommand(cli *CLI) *cobra.Command {
PreRunE: cli.ensureToken,
RunE: cli.wrap(runVolumeCreate),
}
cmd.Flags().String("name", "", "Volume name")
cmd.Flags().String("name", "", "Volume name (required)")
cmd.MarkFlagRequired("name")

cmd.Flags().String("server", "", "Server (ID or name)")
Expand All @@ -31,7 +31,7 @@ func newVolumeCreateCommand(cli *CLI) *cobra.Command {
cobra.BashCompCustom: {"__hcloud_location_names"},
}

cmd.Flags().Int("size", 0, "Size (GB)")
cmd.Flags().Int("size", 0, "Size (GB) (required)")
cmd.MarkFlagRequired("size")

cmd.Flags().Bool("automount", false, "Automount volume after attach (server must be provided)")
Expand Down
3 changes: 2 additions & 1 deletion cli/volume_resize.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func newVolumeResizeCommand(cli *CLI) *cobra.Command {
PreRunE: cli.ensureToken,
RunE: cli.wrap(runVolumeResize),
}
cmd.Flags().Int("size", 0, "New size of the volume")
cmd.Flags().Int("size", 0, "New size (GB) of the volume (required)")
cmd.MarkFlagRequired("size")
return cmd
}
Expand All @@ -41,5 +41,6 @@ func runVolumeResize(cli *CLI, cmd *cobra.Command, args []string) error {
}

fmt.Printf("Volume %d resized\n", volume.ID)
fmt.Printf("You might need to adjust the filesystem size on the server too\n")
return nil
}

0 comments on commit 8245b2f

Please sign in to comment.