Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ User-visible changes to `voltage`, newest first. Each pull request that changes

## Unreleased

- `-o` is short for `--output`, as in `voltage wallets list -o json`.

## 0.2.0 - 2026-10-22

Commands that change something now only describe the change (exit code 6) unless `--execute` or `VOLTAGE_EXECUTE=1` asks to send them: add one of them to scripts that send payments or make other changes. Also new: `voltage context`, interactive pickers, `--no-input` and `--quiet`, and errors that name the next command.
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/global-flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Generated from the command definitions by `VOLTAGE_BLESS=1 cargo test`; do not e
| Flag | Meaning |
|---|---|
| `--json` | Write a stable JSON result envelope |
| `--output OUTPUT` | Output format (`table`, `json`, `ndjson`) |
| `-o`, `--output OUTPUT` | Output format (`table`, `json`, `ndjson`) |
| `--output-file PATH` | Save the complete response to a new owner-only file |
| `--show-secrets` | Explicitly allow secrets in result output |
| `-q`, `--quiet` | Hide optional progress and notices, not errors, results, or recovery IDs |
Expand Down
13 changes: 12 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub struct GlobalFlags {
#[arg(long, global = true, help_heading = "Output")]
pub json: bool,
/// Output format
#[arg(long, global = true, value_enum, help_heading = "Output")]
#[arg(short = 'o', long, global = true, value_enum, help_heading = "Output")]
pub output: Option<OutputFormat>,
/// Save the complete response to a new owner-only file
#[arg(long, global = true, value_name = "PATH", help_heading = "Output")]
Expand Down Expand Up @@ -1381,6 +1381,17 @@ mod tests {
);
}

#[test]
fn short_o_selects_the_output_format_before_or_after_the_subcommand() {
for args in [
["voltage", "-o", "json", "wallets", "list"],
["voltage", "wallets", "list", "-o", "json"],
] {
let invocation = Invocation::try_parse_from(args).unwrap();
assert_eq!(invocation.global.output, Some(OutputFormat::Json));
}
}

#[test]
fn global_flags_work_after_subcommand() {
let invocation = Invocation::try_parse_from([
Expand Down
Loading