diff --git a/README.md b/README.md index fc7b0ba8..f589f8a4 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ > Requires the Rust toolchain. -You can install the binaries from source, by running the following +You can install the binary from source, by running the following commands from inside this repository: cargo install --path . --force --locked @@ -23,10 +23,11 @@ Or directly from our seed node: cargo install --force --locked --git https://seed.radicle.xyz/z39mP9rQAaGmERfUMPULfPUi473tY.git -This will install the following binaries: +This will install `rad-tui`. You can execute it by running `rad tui`. -- `rad-issue-tui` -- `rad-patch-tui` +## Commands + +All available commands can be shown by running `rad tui --help`. ## License diff --git a/bin/commands/help.rs b/bin/commands/help.rs index bc0efa99..9cea6747 100644 --- a/bin/commands/help.rs +++ b/bin/commands/help.rs @@ -14,7 +14,7 @@ pub const HELP: Help = Help { usage: "Usage: rad-tui help [--help]", }; -const COMMANDS: &[Help] = &[tui_help::HELP, tui_patch::HELP]; +const COMMANDS: &[Help] = &[tui_help::HELP]; #[derive(Default)] pub struct Options {} diff --git a/bin/commands/issue.rs b/bin/commands/issue.rs index de066baa..abe2a637 100644 --- a/bin/commands/issue.rs +++ b/bin/commands/issue.rs @@ -8,14 +8,15 @@ use anyhow::anyhow; use crate::terminal; use crate::terminal::args::{Args, Error, Help}; +#[allow(dead_code)] pub const HELP: Help = Help { name: "issue", - description: "Terminal interfaces for patches", + description: "Terminal interfaces for issues", version: env!("CARGO_PKG_VERSION"), usage: r#" Usage - rad-tui patch + rad-tui issue General options @@ -62,6 +63,7 @@ impl Args for Options { } } +#[allow(dead_code)] pub fn run(_options: Options, _ctx: impl terminal::Context) -> anyhow::Result<()> { Ok(()) } diff --git a/bin/commands/patch.rs b/bin/commands/patch.rs index 4addd4c6..dc867000 100644 --- a/bin/commands/patch.rs +++ b/bin/commands/patch.rs @@ -8,6 +8,7 @@ use anyhow::anyhow; use crate::terminal; use crate::terminal::args::{Args, Error, Help}; +#[allow(dead_code)] pub const HELP: Help = Help { name: "patch", description: "Terminal interfaces for patches", @@ -62,6 +63,7 @@ impl Args for Options { } } +#[allow(dead_code)] pub fn run(_options: Options, _ctx: impl terminal::Context) -> anyhow::Result<()> { Ok(()) } diff --git a/bin/main.rs b/bin/main.rs index 88b856ab..1c6627dc 100644 --- a/bin/main.rs +++ b/bin/main.rs @@ -51,15 +51,11 @@ fn parse_args() -> anyhow::Result { command = Some(Command::Version); } Value(val) if command.is_none() => { - if val == *"." { - command = Some(Command::Other(vec![OsString::from("inspect")])); - } else { - let args = iter::once(val) - .chain(iter::from_fn(|| parser.value().ok())) - .collect(); + let args = iter::once(val) + .chain(iter::from_fn(|| parser.value().ok())) + .collect(); - command = Some(Command::Other(args)) - } + command = Some(Command::Other(args)) } _ => return Err(anyhow::anyhow!(arg.unexpected())), } @@ -99,24 +95,8 @@ fn run(command: Command) -> Result<(), Option> { Ok(()) } -fn run_other(exe: &str, args: &[OsString]) -> Result<(), Option> { - match exe { - "issue" => { - terminal::run_command_args::( - tui_issue::HELP, - tui_issue::run, - args.to_vec(), - ); - } - "patch" => { - terminal::run_command_args::( - tui_patch::HELP, - tui_patch::run, - args.to_vec(), - ); - } - other => Err(Some(anyhow!( - "`{other}` is not a command. See `rad-tui --help` for a list of commands.", - ))), - } +fn run_other(exe: &str, _args: &[OsString]) -> Result<(), Option> { + Err(Some(anyhow!( + "`{exe}` is not a command. See `rad-tui --help` for a list of commands.", + ))) } diff --git a/bin/terminal.rs b/bin/terminal.rs index ac4aaaec..828544bd 100644 --- a/bin/terminal.rs +++ b/bin/terminal.rs @@ -46,16 +46,7 @@ where } } -// pub fn run_command(help: Help, cmd: C) -> ! -// where -// A: Args, -// C: Command anyhow::Result>, -// { -// let args = std::env::args_os().skip(1).collect(); - -// run_command_args(help, cmd, args) -// } - +#[allow(dead_code)] pub fn run_command_args(help: Help, cmd: C, args: Vec) -> ! where A: Args, @@ -77,7 +68,7 @@ where } Some(Error::HelpManual { name }) => { let Ok(status) = term::manual(name) else { - term::error(format!("rad {}: failed to load manual page", help.name)); + term::error(format!("rad-tui {}: failed to load manual page", help.name)); process::exit(1); }; process::exit(status.code().unwrap_or(0)); @@ -89,7 +80,7 @@ where Some(Error::WithHint { hint, .. }) => Some(hint), None => None, }; - term::error(format!("rad {}: {err}", help.name)); + term::error(format!("rad-tui {}: {err}", help.name)); if let Some(hint) = hint { term::hint(hint);