Radish alpha
r
rad:z39mP9rQAaGmERfUMPULfPUi473tY
Radicle terminal user interface
Radicle
Git
all: Adjust available operations
Merged did:key:z6MkgFq6...nBGz opened 2 years ago
4 files changed +11 -75 15142a41 4339e29e
modified bin/commands/issue/common.rs
@@ -16,26 +16,18 @@ pub enum Mode {
/// selection widget.
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub enum IssueOperation {
-
    Show,
-
    Delete,
    Edit,
-
    Comment,
+
    Show,
}

impl Display for IssueOperation {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
-
            IssueOperation::Show => {
-
                write!(f, "show")
-
            }
-
            IssueOperation::Delete => {
-
                write!(f, "delete")
-
            }
            IssueOperation::Edit => {
                write!(f, "edit")
            }
-
            IssueOperation::Comment => {
-
                write!(f, "comment")
+
            IssueOperation::Show => {
+
                write!(f, "show")
            }
        }
    }
modified bin/commands/issue/flux/select/ui.rs
@@ -102,17 +102,6 @@ impl Widget<IssuesState, Action> for ListPage {
                    });
                }
            }
-
            Key::Char('c') => {
-
                if let Some(selected) = &self.props.selected {
-
                    let _ = self.action_tx.send(Action::Exit {
-
                        selection: Some(Selection {
-
                            operation: Some(IssueOperation::Comment.to_string()),
-
                            ids: vec![selected.id],
-
                            args: vec![],
-
                        }),
-
                    });
-
                }
-
            }
            Key::Char('e') => {
                if let Some(selected) = &self.props.selected {
                    let _ = self.action_tx.send(Action::Exit {
@@ -124,17 +113,6 @@ impl Widget<IssuesState, Action> for ListPage {
                    });
                }
            }
-
            Key::Char('d') => {
-
                if let Some(selected) = &self.props.selected {
-
                    let _ = self.action_tx.send(Action::Exit {
-
                        selection: Some(Selection {
-
                            operation: Some(IssueOperation::Delete.to_string()),
-
                            ids: vec![selected.id],
-
                            args: vec![],
-
                        }),
-
                    });
-
                }
-
            }
            _ => {
                <Issues as Widget<IssuesState, Action>>::handle_key_event(&mut self.issues, key);
            }
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"),
            ],
        };