1.5 KiB
1.5 KiB
MODIFIED Requirements
Requirement: Root command and global flags
The system SHALL provide a root command pcli that serves as the entry point. The root command SHALL register global flags: --format (string, default json, values json or table), --url (string, overrides PLANKA_URL), --api-key (string, overrides PLANKA_API_KEY), and --log-level (string, default warn, values debug, info, warn, error). The root command SHALL initialize the logger based on --log-level and configure it to write structured JSON to stderr. The root command SHALL validate that URL and API key are available (from flags or environment) before executing any subcommand.
Scenario: Display help
- WHEN
pcliis run with no arguments or--help - THEN the system SHALL display usage information listing all resource subcommands and global flags
Scenario: Invalid format flag
- WHEN
--formatis set to an unsupported value - THEN the system SHALL print an error and exit with code 1
Scenario: Log level controls output
- WHEN
--log-level=debugis set - THEN DEBUG-level log entries SHALL appear on stderr
- AND stdout SHALL contain only the command's data output
Scenario: Missing API key
- WHEN neither
PLANKA_API_KEYenvironment variable nor--api-keyflag is provided - THEN the system SHALL print an error indicating
PLANKA_API_KEYmust be set via--api-keyflag orPLANKA_API_KEYenvironment variable - AND the system SHALL exit with code 1