-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Labels
developmentStandard developmentStandard development
Description
Specification
Currently, we have a parser which parses the input path to ensure valid parameters. In the case of vault paths, the parser check if the path follows the format like vaultName:secretPath
. This is not always ideal, as we want to allow specifying the vault's root directory by simply writing vaultName
.
This is already partially implemented in the secrets ls
command, but this needs to be made a standard. For command which do not operate on directories, like secrets write
, this should be another error thrown from within the command, but this shouldn't be an error thrown at the parsing stage.
# Currently this results in Commander reporting a parser error
$ polykey secrets mkdir vaultX
error: command-argument value 'vaultX' is invalid for argument 'secretPath'. vaultX is not of the format <vaultName>:<directoryPath>[=<value>]
Usage: polykey secrets mkdir [options] <secretPath>
Create a Directory within a Vault
Arguments:
secretPath Path to where the directory to be created, specified as <vaultName>:<directoryPath>
Options:
-np, --node-path <path> Path to Node State (default: "/home/aryanj/.local/share/polykey", env: PK_NODE_PATH)
-pf, --password-file <path> Path to Password
-f, --format <format> Output Format (choices: "human", "json", default: "human")
-v, --verbose Log Verbose Messages (default: 0)
-r, --recursive Create the directory recursively
-ni, --node-id <id> (env: PK_NODE_ID)
-ch, --client-host <host> Client Host Address (env: PK_CLIENT_HOST)
-cp, --client-port <port> Client Port (env: PK_CLIENT_PORT)
-h, --help display help for command
# This should be handled by the command itself
$ polykey secrets mkdir vaultX
ErrorPolykeyCLIDirectoryExists: Directory / already exists
ErrorPolykeyCLIX: Directory / already exists
.
Additional context
- Related comment Polykey-CLI#296 (comment)
Tasks
- Update parser to allow returning undefined secret paths, which is to refer to the root directory
- Raise errors where the command should not accept directories as an argument
- Make tests for every single command ensuring regression testing against this behaviour
Metadata
Metadata
Assignees
Labels
developmentStandard developmentStandard development