bin/issue: Remove selection mode (id-only / operation)

This commit is contained in:
Erik Kundt
2025-12-11 16:14:26 +01:00
parent 284cb9410e
commit edc2bd4811
3 changed files with 2 additions and 37 deletions
-18
View File
@@ -36,12 +36,8 @@ Usage
List options
--mode <MODE> Set selection mode; see MODE below (default: operation)
--json Return JSON on stderr instead of calling `rad`
The MODE argument can be 'operation' or 'id'. 'operation' selects an issue id and
an operation, whereas 'id' selects an issue id only.
Other options
--no-forward Don't forward command to `rad` (default: true)
@@ -70,7 +66,6 @@ pub enum OperationName {
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct ListOptions {
mode: common::Mode,
filter: cob::issue::Filter,
json: bool,
}
@@ -103,18 +98,6 @@ impl Args for Options {
_ => Some(true),
};
}
// 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_state(None);
}
@@ -211,7 +194,6 @@ pub async fn run(options: Options, ctx: impl terminal::Context) -> anyhow::Resul
let context = list::Context {
profile,
repository,
mode: opts.mode,
filter: opts.filter.clone(),
};
-10
View File
@@ -2,16 +2,6 @@ use serde::Serialize;
use radicle::issue::IssueId;
/// 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 issue operation returned by the operation
/// selection widget.
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
+2 -9
View File
@@ -45,14 +45,13 @@ use crate::ui::TerminalInfo;
use self::ui::{Browser, BrowserProps};
use super::common::{IssueOperation, Mode};
use super::common::IssueOperation;
type Selection = tui::Selection<IssueOperation>;
pub struct Context {
pub profile: Profile,
pub repository: Repository,
pub mode: Mode,
pub filter: issue::Filter,
}
@@ -153,7 +152,6 @@ pub struct HelpState {
#[derive(Clone, Debug)]
pub struct State {
mode: Mode,
pages: PageStack<AppPage>,
browser: BrowserState<IssueItem, IssueItemFilter>,
preview: PreviewState,
@@ -211,7 +209,6 @@ impl TryFrom<(&Context, &TerminalInfo)> for State {
.collect();
Ok(Self {
mode: context.mode.clone(),
pages: PageStack::new(vec![AppPage::Browser]),
browser: BrowserState::build(items.clone(), filter, search),
preview: PreviewState {
@@ -401,10 +398,7 @@ fn browser_page(channel: &Channel<Message>) -> Widget<State, Message> {
let shortcuts = if state.browser.is_search_shown() {
vec![("esc", "cancel"), ("enter", "apply")]
} else {
let mut shortcuts = match state.mode {
Mode::Id => vec![("enter", "select")],
Mode::Operation => vec![("enter", "show"), ("e", "edit")],
};
let mut shortcuts = vec![("enter", "show"), ("e", "edit")];
if state.section == Some(Section::Browser) {
shortcuts = [shortcuts, [("/", "search")].to_vec()].concat()
}
@@ -690,7 +684,6 @@ fn help_text() -> String {
# Specific keybindings
`Enter`: Select issue (if --mode id)
`Enter`: Show issue
`e`: Edit issue
`p`: Toggle issue preview