Skip to content

Commit 830f931

Browse files
committed
refactor: align help texts of flags
1 parent 16e160b commit 830f931

29 files changed

+126
-121
lines changed

auth/client_credentials.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ import (
1717
)
1818

1919
type API struct {
20-
URL string `help:"The URL of the Nine API" default:"https://nineapis.ch" env:"NCTL_API_URL" hidden:""`
20+
URL string `help:"URL of the Nine API." default:"https://nineapis.ch" env:"NCTL_API_URL" hidden:""`
2121
Token string `help:"Use a static API token instead of using an OIDC login. Requires the --organization to also be set." env:"NCTL_API_TOKEN" hidden:""`
2222
ClientID string `help:"Use an API client ID to login. Requires the --organization to also be set." env:"NCTL_API_CLIENT_ID"`
2323
ClientSecret string `help:"Use an API client secret to login. Requires the --organization to also be set." env:"NCTL_API_CLIENT_SECRET"`
24-
TokenURL string `help:"Override the default client token URL" hidden:"" default:"${token_url}" env:"NCTL_API_TOKEN_URL"`
24+
TokenURL string `help:"Override the default client token URL." hidden:"" default:"${token_url}" env:"NCTL_API_TOKEN_URL"`
2525
}
2626

2727
type ClientCredentialsCmd struct {

auth/login.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ const (
2727

2828
type LoginCmd struct {
2929
API API `embed:"" prefix:"api-"`
30-
Organization string `help:"The name of your organization to use when providing an API client ID/secret." env:"NCTL_ORGANIZATION"`
31-
IssuerURL string `help:"Issuer URL is the OIDC issuer URL of the API." default:"${issuer_url}" hidden:""`
32-
ClientID string `help:"Client ID is the OIDC client ID of the API." default:"${client_id}" hidden:""`
30+
Organization string `help:"Name of your organization to use when providing an API client ID/secret." env:"NCTL_ORGANIZATION"`
31+
IssuerURL string `help:"OIDC issuer URL of the API." default:"${issuer_url}" hidden:""`
32+
ClientID string `help:"OIDC client ID of the API." default:"${client_id}" hidden:""`
3333
ForceInteractiveEnvOverride bool `help:"Used for internal purposes only. Set to true to force interactive environment explicit override. Set to false to fall back to automatic interactivity detection." default:"false" hidden:""`
3434
tk api.TokenGetter
3535
}

auth/logout.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import (
2222
)
2323

2424
type LogoutCmd struct {
25-
APIURL string `help:"The URL of the Nine API" default:"https://nineapis.ch" env:"NCTL_API_URL" name:"api-url"`
26-
IssuerURL string `help:"Issuer URL is the OIDC issuer URL of the API." default:"https://auth.nine.ch/auth/realms/pub"`
27-
ClientID string `help:"Client ID is the OIDC client ID of the API." default:"nineapis.ch-f178254"`
25+
APIURL string `help:"URL of the Nine API." default:"https://nineapis.ch" env:"NCTL_API_URL" name:"api-url"`
26+
IssuerURL string `help:"OIDC issuer URL of the API." default:"https://auth.nine.ch/auth/realms/pub"`
27+
ClientID string `help:"OIDC client ID of the API." default:"nineapis.ch-f178254"`
2828
tk api.TokenGetter
2929
}
3030

auth/set_org.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212

1313
type SetOrgCmd struct {
1414
Organization string `arg:"" help:"Name of the organization to login to." default:""`
15-
APIURL string `help:"The URL of the Nine API" default:"https://nineapis.ch" env:"NCTL_API_URL" name:"api-url"`
16-
IssuerURL string `help:"Issuer URL is the OIDC issuer URL of the API." default:"https://auth.nine.ch/auth/realms/pub"`
17-
ClientID string `help:"Client ID is the OIDC client ID of the API." default:"nineapis.ch-f178254"`
15+
APIURL string `help:"URL of the Nine API." default:"https://nineapis.ch" env:"NCTL_API_URL" name:"api-url"`
16+
IssuerURL string `help:"OIDC issuer URL of the API." default:"https://auth.nine.ch/auth/realms/pub"`
17+
ClientID string `help:"OIDC client ID of the API." default:"nineapis.ch-f178254"`
1818
}
1919

2020
func (s *SetOrgCmd) Run(ctx context.Context, client *api.Client) error {

auth/whoami.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88
)
99

1010
type WhoAmICmd struct {
11-
APIURL string `help:"The URL of the Nine API" default:"https://nineapis.ch" env:"NCTL_API_URL" name:"api-url"`
12-
IssuerURL string `help:"Issuer URL is the OIDC issuer URL of the API." default:"https://auth.nine.ch/auth/realms/pub"`
13-
ClientID string `help:"Client ID is the OIDC client ID of the API." default:"nineapis.ch-f178254"`
11+
APIURL string `help:"URL of the Nine API." default:"https://nineapis.ch" env:"NCTL_API_URL" name:"api-url"`
12+
IssuerURL string `help:"OIDC issuer URL of the API." default:"https://auth.nine.ch/auth/realms/pub"`
13+
ClientID string `help:"OIDC client ID of the API." default:"nineapis.ch-f178254"`
1414
}
1515

1616
func (s *WhoAmICmd) Run(ctx context.Context, client *api.Client) error {

create/application.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,29 @@ const logPrintTimeout = 10 * time.Second
3737
type applicationCmd struct {
3838
resourceCmd
3939
Git gitConfig `embed:"" prefix:"git-"`
40-
Size *string `help:"Size of the app (defaults to \"${app_default_size}\")." placeholder:"${app_default_size}"`
41-
Port *int32 `help:"Port the app is listening on (defaults to ${app_default_port})." placeholder:"${app_default_port}"`
42-
Replicas *int32 `help:"Amount of replicas of the running app (defaults to ${app_default_replicas})." placeholder:"${app_default_replicas}"`
43-
Hosts []string `help:"Host names where the app can be accessed. If empty, the app will just be accessible on a generated host name on the deploio.app domain."`
44-
BasicAuth *bool `help:"Enable/Disable basic authentication for the app (defaults to ${app_default_basic_auth})." placeholder:"${app_default_basic_auth}"`
45-
Env map[string]string `help:"Environment variables which are passed to the app at runtime."`
46-
SensitiveEnv map[string]string `help:"Sensitive environment variables which are passed to the app at runtime."`
47-
BuildEnv map[string]string `help:"Environment variables which are passed to the app build process."`
48-
SensitiveBuildEnv map[string]string `help:"Sensitive environment variables which are passed to the app build process."`
40+
Size *string `help:"Size of the application (defaults to \"${app_default_size}\")." placeholder:"${app_default_size}"`
41+
Port *int32 `help:"Port the application is listening on (defaults to ${app_default_port})." placeholder:"${app_default_port}"`
42+
Replicas *int32 `help:"Amount of replicas of the running application (defaults to ${app_default_replicas})." placeholder:"${app_default_replicas}"`
43+
Hosts []string `help:"Host names where the application can be accessed. If empty, the application will just be accessible on a generated host name on the deploio.app domain."`
44+
BasicAuth *bool `help:"Enable/Disable basic authentication for the application (defaults to ${app_default_basic_auth})." placeholder:"${app_default_basic_auth}"`
45+
Env map[string]string `help:"Environment variables which are passed to the application at runtime."`
46+
SensitiveEnv map[string]string `help:"Sensitive environment variables which are passed to the application at runtime."`
47+
BuildEnv map[string]string `help:"Environment variables which are passed to the application build process."`
48+
SensitiveBuildEnv map[string]string `help:"Sensitive environment variables which are passed to the application build process."`
4949
DeployJob deployJob `embed:"" prefix:"deploy-job-"`
5050
WorkerJob workerJob `embed:"" prefix:"worker-job-"`
5151
ScheduledJob scheduledJob `embed:"" prefix:"scheduled-job-"`
5252
GitInformationServiceURL string `help:"URL of the git information service." default:"https://git-info.deplo.io" env:"GIT_INFORMATION_SERVICE_URL" hidden:""`
53-
SkipRepoAccessCheck bool `help:"Skip the git repository access check" default:"false"`
54-
Debug bool `help:"Enable debug messages" default:"false"`
53+
SkipRepoAccessCheck bool `help:"Skip the git repository access check." default:"false"`
54+
Debug bool `help:"Enable debug messages." default:"false"`
5555
Language string `help:"${app_language_help} Possible values: ${enum}" enum:"ruby,php,python,golang,nodejs,static," default:""`
5656
DockerfileBuild dockerfileBuild `embed:""`
5757
}
5858

5959
type gitConfig struct {
60-
URL string `required:"" help:"URL to the Git repository containing the app source. Both HTTPS and SSH formats are supported."`
61-
SubPath string `help:"SubPath is a path in the git repo which contains the app code. If not given, the root directory of the git repo will be used."`
62-
Revision string `default:"main" help:"Revision defines the revision of the source to deploy the app to. This can be a commit, tag or branch."`
60+
URL string `required:"" help:"URL to the Git repository containing the application source. Both HTTPS and SSH formats are supported."`
61+
SubPath string `help:"SubPath is a path in the git repository which contains the application code. If not given, the root directory of the git repository will be used."`
62+
Revision string `default:"main" help:"Revision defines the revision of the source to deploy the application to. This can be a commit, tag or branch."`
6363
Username *string `help:"Username to use when authenticating to the git repository over HTTPS." env:"GIT_USERNAME"`
6464
Password *string `help:"Password to use when authenticating to the git repository over HTTPS. In case of GitHub or GitLab, this can also be an access token." env:"GIT_PASSWORD"`
6565
SSHPrivateKey *string `help:"Private key in PEM format to connect to the git repository via SSH." env:"GIT_SSH_PRIVATE_KEY" xor:"SSH_KEY"`
@@ -74,9 +74,9 @@ type deployJob struct {
7474
}
7575

7676
type workerJob struct {
77-
Command string `help:"Command to execute to start the worker." placeholder:"\"bundle exec sidekiq\""`
77+
Command string `help:"Command to execute to start the worker job." placeholder:"\"bundle exec sidekiq\""`
7878
Name string `help:"Name of the worker job to add." placeholder:"worker-1"`
79-
Size *string `help:"Size of the worker (defaults to \"${app_default_size}\")." placeholder:"${app_default_size}"`
79+
Size *string `help:"Size of the worker job (defaults to \"${app_default_size}\")." placeholder:"${app_default_size}"`
8080
}
8181

8282
type scheduledJob struct {
@@ -89,9 +89,9 @@ type scheduledJob struct {
8989
}
9090

9191
type dockerfileBuild struct {
92-
Enabled bool `name:"dockerfile" help:"${app_dockerfile_enable_help}" default:"false"`
93-
Path string `name:"dockerfile-path" help:"${app_dockerfile_path_help}" default:""`
94-
BuildContext string `name:"dockerfile-build-context" help:"${app_dockerfile_build_context_help}" default:""`
92+
Enabled bool `name:"dockerfile" help:"${app_dockerfile_enable_help}." default:"false"`
93+
Path string `name:"dockerfile-path" help:"${app_dockerfile_path_help}." default:""`
94+
BuildContext string `name:"dockerfile-build-context" help:"${app_dockerfile_build_context_help}." default:""`
9595
}
9696

9797
func (g gitConfig) sshPrivateKey() (*string, error) {

create/bucketuser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818

1919
type bucketUserCmd struct {
2020
resourceCmd
21-
Location meta.LocationName `placeholder:"${bucketuser_location_default}" help:"Location where the BucketUser instance is created. Available locations are: ${bucketuser_location_options}"`
21+
Location meta.LocationName `placeholder:"${bucketuser_location_default}" help:"Where the BucketUser instance is created. Available locations are: ${bucketuser_location_options}"`
2222
}
2323

2424
func (cmd *bucketUserCmd) Run(ctx context.Context, client *api.Client) error {

create/cloudvm.go

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package create
33
import (
44
"context"
55
"fmt"
6+
"io"
67
"os"
78
"strings"
89

@@ -18,18 +19,18 @@ import (
1819

1920
type cloudVMCmd struct {
2021
resourceCmd
21-
Location meta.LocationName `default:"nine-es34" help:"Location where the CloudVM instance is created."`
22-
MachineType string `default:"" help:"The machine type defines the sizing for a particular CloudVM."`
23-
Hostname string `default:"" help:"Hostname allows to set the hostname explicitly. If unset, the name of the resource will be used as the hostname. This does not affect the DNS name."`
24-
ReverseDNS string `default:"" help:"Allows to set the reverse DNS of the CloudVM"`
25-
PowerState string `default:"on" help:"Specify the initial power state of the CloudVM. Set to off to create "`
26-
OS string `default:"" help:"OS which should be used to boot the VM. Available options: ${cloudvm_os_flavors}"`
27-
BootDiskSize *resource.Quantity `default:"20Gi" help:"Configures the size of the boot disk."`
28-
Disks map[string]resource.Quantity `default:"" help:"Disks specifies which additional disks to mount to the machine."`
29-
PublicKeys []string `default:"" help:"SSH public keys that can be used to connect to the CloudVM as root. The keys are expected to be in SSH format as defined in RFC4253. Immutable after creation."`
30-
PublicKeysFromFiles []string `default:"" predictor:"file" help:"SSH public key files that can be used to connect to the VM as root. The keys are expected to be in SSH format as defined in RFC4253. Immutable after creation."`
31-
CloudConfig string `default:"" help:"CloudConfig allows to pass custom cloud config data (https://cloudinit.readthedocs.io/en/latest/topics/format.html#cloud-config-data) to the cloud VM. If a CloudConfig is passed, the PublicKey parameter is ignored. Immutable after creation."`
32-
CloudConfigFromFile string `default:"" predictor:"file" help:"CloudConfig via file. Has precedence over args. CloudConfig allows to pass custom cloud config data (https://cloudinit.readthedocs.io/en/latest/topics/format.html#cloud-config-data) to the cloud VM. If a CloudConfig is passed, the PublicKey parameter is ignored. Immutable after creation."`
22+
Location meta.LocationName `default:"nine-es34" help:"Where the CloudVM instance is created."`
23+
MachineType string `default:"" help:"Defines the sizing for a particular CloudVM."`
24+
Hostname string `default:"" help:"Configures the hostname explicitly. If unset, the name of the resource will be used as the hostname. This does not affect the DNS name."`
25+
ReverseDNS string `default:"" help:"Configures the reverse DNS of the CloudVM."`
26+
PowerState infrastructure.VirtualMachinePowerState `default:"on" help:"Specify the initial power state of the CloudVM. Set to off to not start the VM after creation."`
27+
OS infrastructure.OperatingSystem `default:"" help:"Operating system to use to boot the VM. Available options: ${cloudvm_os_flavors}"`
28+
BootDiskSize *resource.Quantity `default:"20Gi" help:"Configures the size of the boot disk."`
29+
Disks map[string]resource.Quantity `default:"" help:"Additional disks to mount to the machine."`
30+
PublicKeys []string `default:"" help:"SSH public keys to connect to the CloudVM as root. The keys are expected to be in SSH format as defined in RFC4253. Immutable after creation."`
31+
PublicKeysFromFiles []*os.File `default:"" predictor:"file" help:"SSH public key files to connect to the VM as root. The keys are expected to be in SSH format as defined in RFC4253. Immutable after creation."`
32+
CloudConfig string `default:"" help:"Pass custom cloud config data (https://cloudinit.readthedocs.io/en/latest/topics/format.html#cloud-config-data) to the cloud VM. If a CloudConfig is passed, the PublicKey parameter is ignored. Immutable after creation."`
33+
CloudConfigFromFile *os.File `default:"" predictor:"file" help:"Pass custom cloud config data (https://cloudinit.readthedocs.io/en/latest/topics/format.html#cloud-config-data) from a file. Takes precedence. If a CloudConfig is passed, the PublicKey parameter is ignored. Immutable after creation."`
3334
}
3435

3536
func (cmd *cloudVMCmd) Run(ctx context.Context, client *api.Client) error {
@@ -87,8 +88,8 @@ func (cmd *cloudVMCmd) newCloudVM(namespace string) (*infrastructure.CloudVirtua
8788
Location: cmd.Location,
8889
MachineType: infrastructure.NewMachineType(cmd.MachineType),
8990
Hostname: cmd.Hostname,
90-
PowerState: infrastructure.VirtualMachinePowerState(cmd.PowerState),
91-
OS: infrastructure.CloudVirtualMachineOS(infrastructure.OperatingSystem(cmd.OS)),
91+
PowerState: cmd.PowerState,
92+
OS: infrastructure.CloudVirtualMachineOS(cmd.OS),
9293
PublicKeys: cmd.PublicKeys,
9394
CloudConfig: cmd.CloudConfig,
9495
ReverseDNS: cmd.ReverseDNS,
@@ -100,19 +101,23 @@ func (cmd *cloudVMCmd) newCloudVM(namespace string) (*infrastructure.CloudVirtua
100101
cloudVM.Spec.ForProvider.PublicKeys = cmd.PublicKeys
101102
var keys []string
102103
for _, file := range cmd.PublicKeysFromFiles {
103-
b, err := os.ReadFile(file)
104-
if err != nil {
105-
return nil, fmt.Errorf("error reading cloudconfig file %q: %w", cmd.PublicKeysFromFiles, err)
104+
if file == nil {
105+
continue
106+
}
107+
108+
b, err := io.ReadAll(file)
109+
if file != nil {
110+
return nil, fmt.Errorf("error reading public keys file: %w", err)
106111
}
107112
keys = append(keys, string(b))
108113
}
109114
cloudVM.Spec.ForProvider.PublicKeys = keys
110115
}
111116

112-
if len(cmd.CloudConfigFromFile) != 0 {
113-
b, err := os.ReadFile(cmd.CloudConfigFromFile)
117+
if cmd.CloudConfigFromFile != nil {
118+
b, err := io.ReadAll(cmd.CloudConfigFromFile)
114119
if err != nil {
115-
return nil, fmt.Errorf("error reading cloudconfig file %q: %w", cmd.CloudConfigFromFile, err)
120+
return nil, fmt.Errorf("error reading cloudconfig file: %w", err)
116121
}
117122
cloudVM.Spec.ForProvider.CloudConfig = string(b)
118123
}

0 commit comments

Comments
 (0)