diff --git a/Cargo.lock b/Cargo.lock index cbb2574..9a509c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -647,7 +647,7 @@ dependencies = [ [[package]] name = "sigi" -version = "3.4.3" +version = "3.5.0" dependencies = [ "chrono", "clap", diff --git a/Cargo.toml b/Cargo.toml index 998a3be..ce37be3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sigi" -version = "3.4.3" +version = "3.5.0" authors = ["J.R. Hill "] edition = "2021" license = "GPL-2.0-only" diff --git a/sigi.1 b/sigi.1 index c5a6418..58382b0 100644 --- a/sigi.1 +++ b/sigi.1 @@ -1,4 +1,4 @@ -.TH sigi 1 "September 21, 2022" "version 3.4.3" "USER COMMANDS" +.TH sigi 1 "November 11, 2022" "version 3.5.0" "USER COMMANDS" .\" .SH NAME sigi \- An organizing tool for terminal lovers who hate organizing diff --git a/src/cli.rs b/src/cli.rs index 0b11954..867ea98 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -68,177 +68,177 @@ pub fn run() { } #[derive(Parser)] -#[clap(name = "sigi", version = SIGI_VERSION, after_help = INTERACT_INSTRUCTIONS, after_long_help = INTERACT_LONG_INSTRUCTIONS)] +#[command(name = "sigi", version = SIGI_VERSION, after_help = INTERACT_INSTRUCTIONS, after_long_help = INTERACT_LONG_INSTRUCTIONS)] /// An organizing tool for terminal lovers who hate organizing struct Cli { - #[clap(flatten)] + #[command(flatten)] fc: FormatConfig, - #[clap(short='t', long, visible_aliases = &["topic", "about", "namespace"])] + #[arg(short='t', long, visible_aliases = &["topic", "about", "namespace"])] /// Manage items in a specific stack stack: Option, - #[clap(subcommand)] + #[command(subcommand)] mode: Option, } #[derive(Subcommand)] enum Mode { /// Run in an interactive mode - #[clap(visible_alias = "i")] + #[command(visible_alias = "i")] Interactive { - #[clap(flatten)] + #[command(flatten)] fc: FormatConfig, }, /// Read input lines from standard input. Same commands as interactive /// mode, but only prints for printing commands. Intended for use in unix /// pipes - #[clap(name = "-")] + #[command(name = "-")] ReadStdin, - #[clap(flatten)] + #[command(flatten)] Command(Command), } #[derive(Subcommand)] enum Command { /// Move the current item to "_history" and mark as completed - #[clap(visible_aliases = &COMPLETE_TERMS[1..])] + #[command(visible_aliases = &COMPLETE_TERMS[1..])] Complete { - #[clap(flatten)] + #[command(flatten)] fc: FormatConfig, }, /// Print the total number of items in the stack - #[clap(visible_aliases = &COUNT_TERMS[1..])] + #[command(visible_aliases = &COUNT_TERMS[1..])] Count { - #[clap(flatten)] + #[command(flatten)] fc: FormatConfig, }, /// Move the current item to "_history" and mark as deleted - #[clap(visible_aliases = &DELETE_TERMS[1..])] + #[command(visible_aliases = &DELETE_TERMS[1..])] Delete { - #[clap(flatten)] + #[command(flatten)] fc: FormatConfig, }, /// Move all items to "_history" and mark as deleted - #[clap(visible_aliases = &DELETE_ALL_TERMS[1..])] + #[command(visible_aliases = &DELETE_ALL_TERMS[1..])] DeleteAll { - #[clap(flatten)] + #[command(flatten)] fc: FormatConfig, }, /// Print the first N items (default is 10) - #[clap(visible_aliases = &HEAD_TERMS[1..])] + #[command(visible_aliases = &HEAD_TERMS[1..])] Head { /// The number of items to display n: Option, - #[clap(flatten)] + #[command(flatten)] fc: FormatConfig, }, /// Print "true" if stack has zero items, or print "false" (and exit with a /// nonzero exit code) if the stack does have items - #[clap(visible_aliases = &IS_EMPTY_TERMS[1..])] + #[command(visible_aliases = &IS_EMPTY_TERMS[1..])] IsEmpty { - #[clap(flatten)] + #[command(flatten)] fc: FormatConfig, }, /// Print all items - #[clap(visible_aliases = &LIST_TERMS[1..])] + #[command(visible_aliases = &LIST_TERMS[1..])] List { - #[clap(flatten)] + #[command(flatten)] fc: FormatConfig, }, /// Print all stacks - #[clap(visible_aliases = &LIST_STACKS_TERMS[1..])] + #[command(visible_aliases = &LIST_STACKS_TERMS[1..])] ListStacks { - #[clap(flatten)] + #[command(flatten)] fc: FormatConfig, }, /// Move current item to another stack - #[clap(arg_required_else_help = true, visible_aliases = &MOVE_TERMS[1..])] + #[command(arg_required_else_help = true, visible_aliases = &MOVE_TERMS[1..])] Move { - #[clap(name = "destination")] + #[arg(name = "destination")] /// The stack that will get the source stack's current item dest: String, - #[clap(flatten)] + #[command(flatten)] fc: FormatConfig, }, /// Move all items to another stack - #[clap(arg_required_else_help = true, visible_aliases = &MOVE_ALL_TERMS[1..])] + #[command(arg_required_else_help = true, visible_aliases = &MOVE_ALL_TERMS[1..])] MoveAll { - #[clap(name = "destination")] + #[arg(name = "destination")] /// The stack that will get all the source stack's items dest: String, - #[clap(flatten)] + #[command(flatten)] fc: FormatConfig, }, /// Cycle to the next item; the current item becomes last - #[clap(visible_aliases = &NEXT_TERMS[1..])] + #[command(visible_aliases = &NEXT_TERMS[1..])] Next { - #[clap(flatten)] + #[command(flatten)] fc: FormatConfig, }, /// Print the first item. This is the default CLI behavior when no command is given - #[clap(visible_aliases = &PEEK_TERMS[1..])] + #[command(visible_aliases = &PEEK_TERMS[1..])] Peek { - #[clap(flatten)] + #[command(flatten)] fc: FormatConfig, }, /// Move items to the top of stack by their number - #[clap(visible_aliases = &PICK_TERMS[1..])] + #[command(visible_aliases = &PICK_TERMS[1..])] Pick { ns: Vec, - #[clap(flatten)] + #[command(flatten)] fc: FormatConfig, }, /// Create a new item - #[clap(visible_aliases = &PUSH_TERMS[1..])] + #[command(visible_aliases = &PUSH_TERMS[1..])] Push { // The content to add as an item. Multiple arguments will be interpreted as a single string content: Vec, - #[clap(flatten)] + #[command(flatten)] fc: FormatConfig, }, /// Rotate the three most-current items - #[clap(visible_aliases = &ROT_TERMS[1..])] + #[command(visible_aliases = &ROT_TERMS[1..])] Rot { - #[clap(flatten)] + #[command(flatten)] fc: FormatConfig, }, /// Swap the two most-current items - #[clap(visible_aliases = &SWAP_TERMS[1..])] + #[command(visible_aliases = &SWAP_TERMS[1..])] Swap { - #[clap(flatten)] + #[command(flatten)] fc: FormatConfig, }, /// Print the last N items (default is 10) - #[clap(visible_aliases = &TAIL_TERMS[1..])] + #[command(visible_aliases = &TAIL_TERMS[1..])] Tail { /// The number of items to display n: Option, - #[clap(flatten)] + #[command(flatten)] fc: FormatConfig, }, } @@ -279,19 +279,19 @@ impl Command { #[derive(Args)] struct FormatConfig { - #[clap(short, long)] + #[arg(short, long)] /// Omit any leading labels or symbols. Recommended for use in shell scripts quiet: bool, - #[clap(short, long)] + #[arg(short, long)] /// Omit any output at all silent: bool, - #[clap(short, long, visible_alias = "noisy")] + #[arg(short, long, visible_alias = "noisy")] /// Print more information, like when an item was created verbose: bool, - #[clap(short, long)] + #[arg(short, long)] /// Use a programmatic format. Options include [csv, json, json-compact, tsv]. Not compatible with quiet/silent/verbose. format: Option, } @@ -334,7 +334,6 @@ impl FormatConfig { } #[derive(ValueEnum, Clone)] -#[clap()] enum ProgrammaticFormat { Csv, Json, diff --git a/tests/basic_sigi_tests.rs b/tests/basic_sigi_tests.rs index dd03fd6..97ab362 100644 --- a/tests/basic_sigi_tests.rs +++ b/tests/basic_sigi_tests.rs @@ -6,6 +6,6 @@ use run_sigi::sigi; fn sigi_version() { let res = sigi("_integ::version", &["--version"]); res.assert_success(); - res.assert_stdout_line_starts_with("sigi 3.4"); + res.assert_stdout_line_starts_with("sigi 3.5"); res.assert_stderr_empty(); } diff --git a/tests/interactive_tests.rs b/tests/interactive_tests.rs index e7f30e1..68cb031 100644 --- a/tests/interactive_tests.rs +++ b/tests/interactive_tests.rs @@ -6,7 +6,7 @@ use run_sigi::{piping, sigi}; fn sigi_interactive_preamble() { let res = sigi("_integ::interactive", &["interactive"]); res.assert_success(); - res.assert_stdout_line_starts_with("sigi 3.4"); + res.assert_stdout_line_starts_with("sigi 3.5"); res.assert_stdout_line_starts_with(r#"Type "quit", "q", or "exit" to quit"#); res.assert_stdout_line_starts_with( r#"Type "?" for quick help, or "help" for a more verbose help message"#, @@ -17,7 +17,7 @@ fn sigi_interactive_preamble() { #[test] fn sigi_interactive_basic() { let res = piping(&["push hello world"]).into_sigi("_integ::interactive", &["interactive"]); - res.assert_stdout_line_starts_with("sigi 3.4"); + res.assert_stdout_line_starts_with("sigi 3.5"); res.assert_stdout_line_starts_with(r#"Type "quit", "q", or "exit" to quit"#); res.assert_stdout_line_starts_with( r#"Type "?" for quick help, or "help" for a more verbose help message"#, diff --git a/tests/run_sigi.rs b/tests/run_sigi.rs index 15260ca..7d14b42 100644 --- a/tests/run_sigi.rs +++ b/tests/run_sigi.rs @@ -259,6 +259,6 @@ fn assert_stderr_empty() { fn sigi_piping_basic() { let res = piping(&[]).into_sigi("_integ::basic", &["interactive"]); assert_eq!(res.status, SigiStatus::Unknown); - res.assert_stdout_line_starts_with("sigi 3.4"); + res.assert_stdout_line_starts_with("sigi 3.5"); res.assert_stderr_empty(); }