Radish alpha
r
Radicle terminal user interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
patch-select: Fix wrong output for --id
Erik Kundt committed 2 years ago
commit 6f2d0a297fb59a3573855ba510cd8e8713f6dd42
parent c61d29ed96046cf87a11ccceab3227792b86c61c
2 files changed +11 -6
modified bin/commands/patch.rs
@@ -53,7 +53,7 @@ pub enum OperationName {
    Select,
}

-
#[derive(Debug, Default, PartialEq, Eq)]
+
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
pub struct SelectOptions {
    subject: select::Subject,
}
@@ -133,9 +133,14 @@ pub fn run(options: Options, _ctx: impl terminal::Context) -> anyhow::Result<()>
                    .map(|o| serde_json::to_string(&o).unwrap_or_default())
                    .unwrap_or_default()
            } else {
-
                output
-
                    .map(|o| format!("rad patch {}", o))
-
                    .unwrap_or_default()
+
                match options.op {
+
                    Operation::Select { opts } => match opts.subject {
+
                        select::Subject::Id => output.map(|o| format!("{}", o)).unwrap_or_default(),
+
                        select::Subject::Operation => output
+
                            .map(|o| format!("rad patch {}", o))
+
                            .unwrap_or_default(),
+
                    },
+
                }
            };

            eprint!("{output}");
modified bin/commands/patch/select.rs
@@ -54,7 +54,7 @@ impl Serialize for PatchId {
/// which widgets to render and which output to produce.
///
/// Depends on CLI arguments given by the user.
-
#[derive(Clone, Default, Debug, Eq, PartialEq)]
+
#[derive(Clone, Default, Copy, Debug, Eq, PartialEq)]
pub enum Subject {
    #[default]
    Operation,
@@ -177,7 +177,7 @@ impl App {
        app: &mut Application<Cid, Message, NoUserEvent>,
        theme: &Theme,
    ) -> Result<()> {
-
        let home = Box::new(ListView::new(self.subject.clone()));
+
        let home = Box::new(ListView::new(self.subject));
        self.pages.push(home, app, &self.context, theme)?;

        Ok(())