From 38fa4297ff6dc5ae642f3be56b0ba12313899e98 Mon Sep 17 00:00:00 2001 From: Erik Kundt Date: Thu, 11 Dec 2025 16:16:49 +0100 Subject: [PATCH] bin/patch: Remove selection mode (id-only / operation) --- bin/commands/patch.rs | 24 +----------------------- bin/commands/patch/common.rs | 11 ----------- bin/commands/patch/list.rs | 24 ++++++++---------------- 3 files changed, 9 insertions(+), 50 deletions(-) diff --git a/bin/commands/patch.rs b/bin/commands/patch.rs index 36ae7833..b4ca3241 100644 --- a/bin/commands/patch.rs +++ b/bin/commands/patch.rs @@ -19,7 +19,6 @@ use radicle_cli::terminal; use radicle_cli::terminal::args::{string, Args, Error, Help}; use crate::cob::patch; -use crate::cob::patch::Filter; use crate::commands::tui_patch::common::PatchOperation; pub const HELP: Help = Help { @@ -33,9 +32,6 @@ Usage List options - --mode Set selection mode; see MODE below (default: operation) - --json Return JSON on stderr instead of calling `rad` - --all Show all patches, including merged and archived patches --archived Show only archived patches --merged Show only merged patches @@ -45,9 +41,7 @@ List options --author Show only patched where the given user is an author (may be specified multiple times) - The MODE argument can be 'operation' or 'id'. 'operation' selects a patch id and - an operation, whereas 'id' selects a patch id only. - + --json Return JSON on stderr instead of calling `rad` Other options @@ -80,7 +74,6 @@ pub enum OperationName { #[derive(Debug, Default, Clone, PartialEq, Eq)] pub struct ListOptions { - mode: common::Mode, filter: patch::Filter, json: bool, } @@ -149,17 +142,6 @@ impl Args for Options { }; } - // select options. - Long("mode") | Short('m') if op == OperationName::List => { - let val = parser.value()?; - let val = val.to_str().unwrap_or_default(); - - list_opts.mode = match val { - "operation" => common::Mode::Operation, - "id" => common::Mode::Id, - unknown => anyhow::bail!("unknown mode '{}'", unknown), - }; - } Long("all") if op == OperationName::List => { list_opts.filter = list_opts.filter.with_status(None); } @@ -232,9 +214,6 @@ impl Args for Options { } // Configure list options - if list_opts.mode == common::Mode::Id { - list_opts.filter = Filter::default().with_status(None) - } list_opts.json = json; // Map local commands. Forward help and ignore `no-forward`. @@ -377,7 +356,6 @@ mod interface { let context = list::Context { profile, repository, - mode: opts.mode, filter: opts.filter.clone(), }; diff --git a/bin/commands/patch/common.rs b/bin/commands/patch/common.rs index 59d99383..96185b5f 100644 --- a/bin/commands/patch/common.rs +++ b/bin/commands/patch/common.rs @@ -1,17 +1,6 @@ use radicle::patch::PatchId; use serde::Serialize; -/// The application's mode. It tells the application -/// which widgets to render and which output to produce. -/// -/// Depends on CLI arguments given by the user. -#[derive(Clone, Default, Debug, Eq, PartialEq)] -pub enum Mode { - #[default] - Operation, - Id, -} - /// The selected patch operation returned by the operation /// selection widget. #[derive(Clone, Debug, Eq, PartialEq, Serialize)] diff --git a/bin/commands/patch/list.rs b/bin/commands/patch/list.rs index 0d0ab93d..0f418e5d 100644 --- a/bin/commands/patch/list.rs +++ b/bin/commands/patch/list.rs @@ -23,7 +23,7 @@ use tui::ui::im::Show; use tui::ui::{BufferedValue, Column, Spacing}; use tui::{Channel, Exit}; -use super::common::{Mode, PatchOperation}; +use super::common::PatchOperation; use crate::cob::patch; use crate::ui::items::filter::Filter; @@ -42,7 +42,6 @@ const HELP: &str = r#"# Generic keybindings # Specific keybindings -`enter`: Select patch (if --mode id) `enter`: Show patch `c`: Checkout patch `d`: Show patch diff @@ -59,7 +58,6 @@ type Selection = tui::Selection; pub struct Context { pub profile: Profile, pub repository: Repository, - pub mode: Mode, pub filter: patch::Filter, } @@ -117,7 +115,6 @@ pub enum Page { #[derive(Clone, Debug)] pub struct AppState { - mode: Mode, page: Page, main_group: ContainerState, patches: TableState, @@ -156,7 +153,6 @@ impl TryFrom<&Context> for App { Ok(App { patches: Arc::new(Mutex::new(items.clone())), state: AppState { - mode: context.mode.clone(), page: Page::Main, main_group: ContainerState::new(3, Some(0)), patches: TableState::new(Some(0)), @@ -559,17 +555,13 @@ impl App { pub fn show_browser_shortcuts(&self, frame: &mut Frame, ui: &mut im::Ui) { ui.shortcuts( frame, - &match self.state.mode { - Mode::Id => [("enter", "select"), ("/", "search")].to_vec(), - Mode::Operation => [ - ("enter", "show"), - ("c", "checkout"), - ("d", "diff"), - ("/", "search"), - ("?", "help"), - ] - .to_vec(), - }, + &[ + ("enter", "show"), + ("c", "checkout"), + ("d", "diff"), + ("/", "search"), + ("?", "help"), + ], '∙', ); }