Skip to content

Commit

Permalink
renaming flags and performing some CLI refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
shibme committed Mar 3, 2024
1 parent 847414d commit d6e7084
Show file tree
Hide file tree
Showing 8 changed files with 352 additions and 368 deletions.
20 changes: 10 additions & 10 deletions cli/internal/commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ var (
envSelfSetCmd *cobra.Command

// Vault Commands
vaultCmd *cobra.Command
vaultInfoCmd *cobra.Command
vaultNewCmd *cobra.Command
vaultShareCmd *cobra.Command
vaultCmd *cobra.Command
vaultNewCmd *cobra.Command
vaultShareCmd *cobra.Command
vaultInfoCmd *cobra.Command
vaultPutCmd *cobra.Command
vaultGetCmd *cobra.Command
vaultExportCmd *cobra.Command
vaultRefCmd *cobra.Command
vaultDerefCmd *cobra.Command

// Secret Commands
secretCmd *cobra.Command
secretPutCmd *cobra.Command
secretGetCmd *cobra.Command
secretExportCmd *cobra.Command
secretRefCmd *cobra.Command
secretDerefCmd *cobra.Command
// secretCmd *cobra.Command
)
41 changes: 18 additions & 23 deletions cli/internal/commands/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,12 @@ var (
}

envAddFlag = FlagDef{
name: "add",
shorthand: "a",
usage: "Adds environment to default profile",
name: "add",
usage: "Adds environment to default profile",
}

envSearchFlag = FlagDef{
name: "search-env",
name: "search",
shorthand: "s",
usage: "Searches query to filter environments",
}
Expand Down Expand Up @@ -105,20 +104,20 @@ var (
// Vault Command Flags

vaultFileFlag = FlagDef{
name: "vault-file",
name: "vault",
shorthand: "v",
usage: "Path to the vault file [Must end with .slv.yml or .slv.yaml]",
usage: "Path to the vault file [Should end with .slv.yml or .slv.yaml]",
}

vaultAccessPublicKeysFlag = FlagDef{
name: "public-keys",
name: "pubkey",
shorthand: "k",
usage: "Public keys of environments or groups that can access the vault",
usage: "Public keys of environments that can access the vault",
}

vaultEnableHashingFlag = FlagDef{
name: "enable-hash",
usage: "Preserve a partial secret hash for the purpose of validating secret rotation [Not recommended, though it might be resilient from brute-forcing]",
name: "hash",
usage: "Enables hashing by preserving a partial hash of the actual secret for the purpose of validating secret rotation [Not recommended, though it might be difficult to brute-force]",
}

vaultK8sFlag = FlagDef{
Expand All @@ -135,9 +134,8 @@ var (
}

secretValueFlag = FlagDef{
name: "secret",
shorthand: "s",
usage: "Secret to be added to the vault",
name: "secret",
usage: "Secret to be added to the vault",
}

secretForceUpdateFlag = FlagDef{
Expand All @@ -147,7 +145,7 @@ var (

secretListFormatFlag = FlagDef{
name: "format",
usage: "List secrets as one of [json, yaml, table, envars]. Defaults to table.",
usage: "List secrets as one of [json, yaml, table, envar]. Defaults to envar",
}

secretEncodeBase64Flag = FlagDef{
Expand All @@ -156,20 +154,17 @@ var (
}

secretRefFileFlag = FlagDef{
name: "file",
shorthand: "f",
usage: "Path to the YAML/JSON file",
name: "ref-file",
usage: "Path to the YAML/JSON file to be referenced",
}

secretRefTypeFlag = FlagDef{
name: "type",
shorthand: "t",
usage: "Data format to be considered for the file to be referenced",
name: "ref-format",
usage: "Data serialization format of the referenced file",
}

secretRefPreviewOnlyFlag = FlagDef{
name: "preview",
shorthand: "p",
usage: "Preview only mode",
name: "preview",
usage: "Preview only mode",
}
)
2 changes: 2 additions & 0 deletions cli/internal/commands/kms.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ func newKMSEnvCommand(kmsName, kmsProviderDesc string, keyIdFlag FlagDef) *cobra
newKMSEnvCmd := &cobra.Command{
Use: kmsName,
Short: kmsProviderDesc,
Long: kmsProviderDesc +
" - Uses RSA 4096 key with SHA-256 hashing in case of asymmetric binding. Create a KMS key accordingly.",
Run: func(cmd *cobra.Command, args []string) {
envName, _ := cmd.Flags().GetString(envNameFlag.name)
envEmail, _ := cmd.Flags().GetString(envEmailFlag.name)
Expand Down
Loading

0 comments on commit d6e7084

Please sign in to comment.