Skip to content

Commit d46eded

Browse files
committed
fix: fallback to COMP_LINE for project parsing
1 parent efd27d0 commit d46eded

File tree

23 files changed

+209
-26
lines changed

23 files changed

+209
-26
lines changed

apply/apply.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ package apply
33
import "os"
44

55
type Cmd struct {
6-
Filename *os.File `short:"f" predictor:"file"`
6+
Filename *os.File `short:"f" completion-predictor:"file"`
77
FromFile fromFile `cmd:"" default:"1" name:"-f <file>" help:"Apply any resource from a yaml or json file."`
88
}

auth/set_project.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
)
1414

1515
type SetProjectCmd struct {
16-
Name string `arg:"" help:"Name of the default project to be used." predictor:"project_name"`
16+
Name string `arg:"" help:"Name of the default project to be used." completion-predictor:"project_name"`
1717
}
1818

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

copy/copy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ type Cmd struct {
1212
}
1313

1414
type resourceCmd struct {
15-
Name string `arg:"" help:"Name of the resource to copy." default:"" predictor:"resource_name"`
15+
Name string `arg:"" help:"Name of the resource to copy." default:"" completion-predictor:"resource_name"`
1616
TargetName string `help:"Target name of the new resource. A random name is generated if omitted." default:""`
17-
TargetProject string `help:"Target project of the new resource. The current project is used if omitted." default:"" predictor:"project_name"`
17+
TargetProject string `help:"Target project of the new resource. The current project is used if omitted." default:"" completion-predictor:"project_name"`
1818
}
1919

2020
func getName(name string) string {

create/application.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ type gitConfig struct {
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"`
66-
SSHPrivateKeyFromFile *string `help:"Path to a file containing a private key in PEM format to connect to the git repository via SSH." env:"GIT_SSH_PRIVATE_KEY_FROM_FILE" xor:"SSH_KEY" predictor:"file"`
66+
SSHPrivateKeyFromFile *string `help:"Path to a file containing a private key in PEM format to connect to the git repository via SSH." env:"GIT_SSH_PRIVATE_KEY_FROM_FILE" xor:"SSH_KEY" completion-predictor:"file"`
6767
}
6868

6969
type healthProbe struct {

create/cloudvm.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ type cloudVMCmd struct {
2828
BootDiskSize *resource.Quantity `default:"20Gi" help:"Configures the size of the boot disk."`
2929
Disks map[string]resource.Quantity `default:"" help:"Additional disks to mount to the machine."`
3030
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."`
31+
PublicKeysFromFiles []*os.File `default:"" completion-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."`
3232
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."`
33+
CloudConfigFromFile *os.File `default:"" completion-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."`
3434
}
3535

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

create/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
)
2222

2323
type Cmd struct {
24-
Filename *os.File `short:"f" help:"Create any resource from a yaml or json file." predictor:"file"`
24+
Filename *os.File `short:"f" help:"Create any resource from a yaml or json file." completion-predictor:"file"`
2525
FromFile fromFile `cmd:"" default:"1" name:"-f <file>" help:"Create any resource from a yaml or json file."`
2626
VCluster vclusterCmd `cmd:"" group:"infrastructure.nine.ch" name:"vcluster" help:"Create a new vcluster."`
2727
APIServiceAccount apiServiceAccountCmd `cmd:"" group:"iam.nine.ch" name:"apiserviceaccount" aliases:"asa" help:"Create a new API Service Account."`

create/mysql.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type mySQLCmd struct {
2525
MachineType string `placeholder:"${mysql_machine_default}" help:"Sizing for a particular MySQL instance. Available types: ${mysql_machine_types}"`
2626
AllowedCidrs []meta.IPv4CIDR `placeholder:"203.0.113.1/32" help:"IP addresses allowed to connect to the instance."`
2727
SSHKeys []storage.SSHKey `help:"SSH public keys allowed to connect to the database server in order to up-/download and directly restore database backups."`
28-
SSHKeysFile *os.File `predictor:"file" help:"Path to a file containing a list of SSH public keys (see above), separated by newlines. Lines prefixed with # are ignored."`
28+
SSHKeysFile *os.File `completion-predictor:"file" help:"Path to a file containing a list of SSH public keys (see above), separated by newlines. Lines prefixed with # are ignored."`
2929
SQLMode *[]storage.MySQLMode `placeholder:"\"MODE1, MODE2, ...\"" help:"Configures the sql_mode setting. Modes affect the SQL syntax MySQL supports and the data validation checks it performs. Defaults to: ${mysql_mode}"`
3030
CharacterSetName string `placeholder:"${mysql_charset}" help:"Configures the character_set_server variable."`
3131
CharacterSetCollation string `placeholder:"${mysql_collation}" help:"Configures the collation_server variable."`

create/postgres.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type postgresCmd struct {
2424
MachineType string `placeholder:"${postgres_machine_default}" help:"Defines the sizing for a particular PostgreSQL instance. Available types: ${postgres_machine_types}"`
2525
AllowedCidrs []meta.IPv4CIDR `placeholder:"203.0.113.1/32" help:"IP addresses allowed to connect to the instance."`
2626
SSHKeys []storage.SSHKey `help:"SSH public keys allowed to connect to the database server in order to up-/download and directly restore database backups."`
27-
SSHKeysFile *os.File `predictor:"file" help:"Path to a file containing a list of SSH public keys (see above), separated by newlines. Lines prefixed with # are ignored."`
27+
SSHKeysFile *os.File `completion-predictor:"file" help:"Path to a file containing a list of SSH public keys (see above), separated by newlines. Lines prefixed with # are ignored."`
2828
PostgresVersion storage.PostgresVersion `placeholder:"${postgres_version_default}" help:"Release version with which the PostgreSQL instance is created. Available versions: ${postgres_versions}"`
2929
KeepDailyBackups *int `placeholder:"${postgres_backup_retention_days}" help:"Number of daily database backups to keep. Note that setting this to 0, backup will be disabled and existing dumps deleted immediately."`
3030
}

delete/delete.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
)
1414

1515
type Cmd struct {
16-
Filename *os.File `short:"f" predictor:"file"`
16+
Filename *os.File `short:"f" completion-predictor:"file"`
1717
FromFile fromFile `cmd:"" default:"1" name:"-f <file>" help:"Delete any resource from a yaml or json file."`
1818
VCluster vclusterCmd `cmd:"" group:"infrastructure.nine.ch" name:"vcluster" help:"Delete a vcluster."`
1919
APIServiceAccount apiServiceAccountCmd `cmd:"" group:"iam.nine.ch" name:"apiserviceaccount" aliases:"asa" help:"Delete an API Service Account."`
@@ -33,7 +33,7 @@ type Cmd struct {
3333
}
3434

3535
type resourceCmd struct {
36-
Name string `arg:"" predictor:"resource_name" help:"Name of the resource to delete."`
36+
Name string `arg:"" completion-predictor:"resource_name" help:"Name of the resource to delete."`
3737
Force bool `default:"false" help:"Do not ask for confirmation of deletion."`
3838
Wait bool `default:"true" help:"Wait until resource is fully deleted."`
3939
WaitTimeout time.Duration `default:"5m" help:"Duration to wait for the deletion. Only relevant if wait is set."`

edit/edit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type Cmd struct {
3939
}
4040

4141
type resourceCmd struct {
42-
Name string `arg:"" predictor:"resource_name" help:"Name of the resource to edit." required:""`
42+
Name string `arg:"" completion-predictor:"resource_name" help:"Name of the resource to edit." required:""`
4343
}
4444

4545
const header = `# Please edit the %s below.

0 commit comments

Comments
 (0)