From 8245b2f5d5d8c585ff577571cf49456da054104f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20K=C3=A4mmerling?= Date: Fri, 17 Jul 2020 08:56:18 +0200 Subject: [PATCH] Add (required) to help text of all required lags (#253) --- cli/certificate_create.go | 6 +++--- cli/floatingip_create.go | 2 +- cli/floatingip_set_rdns.go | 2 +- cli/load_balancer_add_service.go | 2 +- cli/load_balancer_attach_to_network.go | 2 +- cli/load_balancer_create.go | 4 ++-- cli/load_balancer_delete_service.go | 2 +- cli/load_balancer_detach_from_network.go | 2 +- cli/load_balancer_update_service.go | 2 +- cli/network_add_route.go | 4 ++-- cli/network_change_ip_range.go | 2 +- cli/network_create.go | 4 ++-- cli/network_remove_route.go | 4 ++-- cli/network_remove_subnet.go | 2 +- cli/server_attach_to_network.go | 2 +- cli/server_change_alias_ips.go | 2 +- cli/server_create.go | 6 +++--- cli/server_create_image.go | 2 +- cli/server_detach_from_network.go | 2 +- cli/server_rebuild.go | 2 +- cli/server_set_rdns.go | 2 +- cli/sshkey_create.go | 2 +- cli/volume_attach.go | 2 +- cli/volume_create.go | 4 ++-- cli/volume_resize.go | 3 ++- 25 files changed, 35 insertions(+), 34 deletions(-) diff --git a/cli/certificate_create.go b/cli/certificate_create.go index 3b776f3e..9ff88228 100644 --- a/cli/certificate_create.go +++ b/cli/certificate_create.go @@ -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 diff --git a/cli/floatingip_create.go b/cli/floatingip_create.go index 91b8d250..6cd0c1da 100644 --- a/cli/floatingip_create.go +++ b/cli/floatingip_create.go @@ -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"}, } diff --git a/cli/floatingip_set_rdns.go b/cli/floatingip_set_rdns.go index 877a1057..4c3c111b 100644 --- a/cli/floatingip_set_rdns.go +++ b/cli/floatingip_set_rdns.go @@ -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") diff --git a/cli/load_balancer_add_service.go b/cli/load_balancer_add_service.go index 5ceba179..ac5b9453 100644 --- a/cli/load_balancer_add_service.go +++ b/cli/load_balancer_add_service.go @@ -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") diff --git a/cli/load_balancer_attach_to_network.go b/cli/load_balancer_attach_to_network.go index efb033f3..4edb25c7 100644 --- a/cli/load_balancer_attach_to_network.go +++ b/cli/load_balancer_attach_to_network.go @@ -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"}, } diff --git a/cli/load_balancer_create.go b/cli/load_balancer_create.go index d49bd1ba..d459cbd6 100644 --- a/cli/load_balancer_create.go +++ b/cli/load_balancer_create.go @@ -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"}, } diff --git a/cli/load_balancer_delete_service.go b/cli/load_balancer_delete_service.go index 70d71666..db1418c0 100644 --- a/cli/load_balancer_delete_service.go +++ b/cli/load_balancer_delete_service.go @@ -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 } diff --git a/cli/load_balancer_detach_from_network.go b/cli/load_balancer_detach_from_network.go index 1f6d5f3d..808462ca 100644 --- a/cli/load_balancer_detach_from_network.go +++ b/cli/load_balancer_detach_from_network.go @@ -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"}, } diff --git a/cli/load_balancer_update_service.go b/cli/load_balancer_update_service.go index 5b4f0f3f..b3b543e0 100644 --- a/cli/load_balancer_update_service.go +++ b/cli/load_balancer_update_service.go @@ -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") diff --git a/cli/network_add_route.go b/cli/network_add_route.go index 2712d9e0..fb0bf89a 100644 --- a/cli/network_add_route.go +++ b/cli/network_add_route.go @@ -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 diff --git a/cli/network_change_ip_range.go b/cli/network_change_ip_range.go index f2055198..3b7ec764 100644 --- a/cli/network_change_ip_range.go +++ b/cli/network_change_ip_range.go @@ -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 diff --git a/cli/network_create.go b/cli/network_create.go index 30e12ff5..7f92977f 100644 --- a/cli/network_create.go +++ b/cli/network_create.go @@ -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)") diff --git a/cli/network_remove_route.go b/cli/network_remove_route.go index 9ad02b52..e45ce117 100644 --- a/cli/network_remove_route.go +++ b/cli/network_remove_route.go @@ -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 diff --git a/cli/network_remove_subnet.go b/cli/network_remove_subnet.go index ac0c588b..66ee2423 100644 --- a/cli/network_remove_subnet.go +++ b/cli/network_remove_subnet.go @@ -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 } diff --git a/cli/server_attach_to_network.go b/cli/server_attach_to_network.go index 13a5ceea..4bbe78f1 100644 --- a/cli/server_attach_to_network.go +++ b/cli/server_attach_to_network.go @@ -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"}, } diff --git a/cli/server_change_alias_ips.go b/cli/server_change_alias_ips.go index eb7efe9e..38e130f2 100644 --- a/cli/server_change_alias_ips.go +++ b/cli/server_change_alias_ips.go @@ -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"}, } diff --git a/cli/server_create.go b/cli/server_create.go index f30f4258..fcd7e711 100644 --- a/cli/server_create.go +++ b/cli/server_create.go @@ -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"}, } diff --git a/cli/server_create_image.go b/cli/server_create_image.go index a520dd30..1c47577b 100644 --- a/cli/server_create_image.go +++ b/cli/server_create_image.go @@ -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"}, } diff --git a/cli/server_detach_from_network.go b/cli/server_detach_from_network.go index 53ffad94..4e55dd3a 100644 --- a/cli/server_detach_from_network.go +++ b/cli/server_detach_from_network.go @@ -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"}, } diff --git a/cli/server_rebuild.go b/cli/server_rebuild.go index 7c0d9160..47d5f97f 100644 --- a/cli/server_rebuild.go +++ b/cli/server_rebuild.go @@ -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"}, } diff --git a/cli/server_set_rdns.go b/cli/server_set_rdns.go index b9a1ed6d..baa36a95 100644 --- a/cli/server_set_rdns.go +++ b/cli/server_set_rdns.go @@ -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") diff --git a/cli/sshkey_create.go b/cli/sshkey_create.go index 26f7baa7..b4311f55 100644 --- a/cli/sshkey_create.go +++ b/cli/sshkey_create.go @@ -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)") diff --git a/cli/volume_attach.go b/cli/volume_attach.go index ec3296d1..383f21fe 100644 --- a/cli/volume_attach.go +++ b/cli/volume_attach.go @@ -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"}, } diff --git a/cli/volume_create.go b/cli/volume_create.go index 1280c57e..388808de 100644 --- a/cli/volume_create.go +++ b/cli/volume_create.go @@ -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)") @@ -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)") diff --git a/cli/volume_resize.go b/cli/volume_resize.go index 530664f5..f7879146 100644 --- a/cli/volume_resize.go +++ b/cli/volume_resize.go @@ -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 } @@ -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 }