Steps to reproduce
cd /home/keenan/Projects/rodent-software/vole
./vole admin --config /tmp/vole-demo/vole.toml account list
Result:
usage: vole admin account <command> [options] [args]
...
vole: unknown account subcommand "--config"
Cause
cmdAdmin handles --config as an admin-namespace global and then rebuilds the local argument list as:
local = append(local, "--config", cfgPath)
local = append(local, subargs...)
so cmdAccount receives --config <path> list. cmdAccount expects the subcommand first (list) and parses the remaining arguments for --config, so it sees --config as the subcommand.
Workaround
Use the environment variable:
VOLE_CONFIG=/tmp/vole-demo/vole.toml ./vole admin account list
Fix
- Put
--configafter the resource subcommand, or - Teach each local admin command to parse the config global before the subcommand.
Add a test that runs vole admin --config <path> account list and asserts it lists accounts rather than exiting with a usage error.
Acceptance
vole admin --config <path> account list,repo list, andacl show <repo>all work.VOLE_CONFIGcontinues to work.