Radish alpha
r
Radicle terminal user interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
patch: Adjust available operations
Erik Kundt committed 2 years ago
commit 6ee251af09584ff7c3a94d8df68c95ae64f70660
parent 15142a41e374c95bb0a4758b01892cedf49cb346
2 files changed +8 -42
modified bin/commands/patch/common.rs
@@ -17,30 +17,22 @@ pub enum Mode {
/// selection widget.
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub enum PatchOperation {
-
    Show,
    Checkout,
-
    Delete,
-
    Edit,
-
    Comment,
+
    Diff,
+
    Show,
}

impl Display for PatchOperation {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
-
            PatchOperation::Show => {
-
                write!(f, "show")
-
            }
            PatchOperation::Checkout => {
                write!(f, "checkout")
            }
-
            PatchOperation::Delete => {
-
                write!(f, "delete")
-
            }
-
            PatchOperation::Edit => {
-
                write!(f, "edit")
+
            PatchOperation::Diff => {
+
                write!(f, "diff")
            }
-
            PatchOperation::Comment => {
-
                write!(f, "comment")
+
            PatchOperation::Show => {
+
                write!(f, "show")
            }
        }
    }
modified bin/commands/patch/flux/select/ui.rs
@@ -115,34 +115,10 @@ impl Widget<PatchesState, Action> for ListPage {
                    });
                }
            }
-
            Key::Char('m') => {
-
                if let Some(selected) = &self.props.selected {
-
                    let selection = Selection {
-
                        operation: Some(PatchOperation::Comment.to_string()),
-
                        ids: vec![selected.id],
-
                        args: vec![],
-
                    };
-
                    let _ = self.action_tx.send(Action::Exit {
-
                        selection: Some(selection),
-
                    });
-
                }
-
            }
-
            Key::Char('e') => {
-
                if let Some(selected) = &self.props.selected {
-
                    let selection = Selection {
-
                        operation: Some(PatchOperation::Edit.to_string()),
-
                        ids: vec![selected.id],
-
                        args: vec![],
-
                    };
-
                    let _ = self.action_tx.send(Action::Exit {
-
                        selection: Some(selection),
-
                    });
-
                }
-
            }
            Key::Char('d') => {
                if let Some(selected) = &self.props.selected {
                    let selection = Selection {
-
                        operation: Some(PatchOperation::Delete.to_string()),
+
                        operation: Some(PatchOperation::Diff.to_string()),
                        ids: vec![selected.id],
                        args: vec![],
                    };
@@ -168,9 +144,7 @@ impl Render<()> for ListPage {
            Mode::Operation => vec![
                Shortcut::new("enter", "show"),
                Shortcut::new("c", "checkout"),
-
                Shortcut::new("m", "comment"),
-
                Shortcut::new("e", "edit"),
-
                Shortcut::new("d", "delete"),
+
                Shortcut::new("d", "diff"),
            ],
        };