mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 01:18:21 +00:00
single lookup place for key symbols in preperation for #465
This commit is contained in:
parent
995ae928ac
commit
24758d494d
2 changed files with 248 additions and 138 deletions
141
src/keys.rs
141
src/keys.rs
|
|
@ -120,6 +120,7 @@ impl Default for KeyConfig {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl KeyConfig {
|
||||
fn save(&self) -> Result<()> {
|
||||
let config_file = Self::get_config_file()?;
|
||||
|
|
@ -165,88 +166,94 @@ impl KeyConfig {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The hint follows apple design
|
||||
// http://xahlee.info/comp/unicode_computing_symbols.html
|
||||
pub fn get_hint(ev: KeyEvent) -> String {
|
||||
match ev.code {
|
||||
KeyCode::Char(c) => {
|
||||
format!("{}{}", get_modifier_hint(ev.modifiers), c)
|
||||
//TODO: make this configurable (https://github.com/extrawurst/gitui/issues/465)
|
||||
#[allow(clippy::unused_self)]
|
||||
const fn get_key_symbol(&self, k: KeyCode) -> &str {
|
||||
match k {
|
||||
KeyCode::Enter => "\u{23ce}", //⏎
|
||||
KeyCode::Left => "\u{2190}", //←
|
||||
KeyCode::Right => "\u{2192}", //→
|
||||
KeyCode::Up => "\u{2191}", //↑
|
||||
KeyCode::Down => "\u{2193}", //↓
|
||||
KeyCode::Backspace => "\u{232b}", //⌫
|
||||
KeyCode::Home => "\u{2912}", //⤒
|
||||
KeyCode::End => "\u{2913}", //⤓
|
||||
KeyCode::PageUp => "\u{21de}", //⇞
|
||||
KeyCode::PageDown => "\u{21df}", //⇟
|
||||
KeyCode::Tab => "\u{21e5}", //⇥
|
||||
KeyCode::BackTab => "\u{21e4}", //⇤
|
||||
KeyCode::Delete => "\u{2326}", //⌦
|
||||
KeyCode::Insert => "\u{2380}", //⎀
|
||||
KeyCode::Esc => "\u{238b}", //⎋
|
||||
_ => "?",
|
||||
}
|
||||
KeyCode::Enter => {
|
||||
format!("{}\u{23ce}", get_modifier_hint(ev.modifiers)) //⏎
|
||||
}
|
||||
KeyCode::Left => {
|
||||
format!("{}\u{2190}", get_modifier_hint(ev.modifiers)) //←
|
||||
}
|
||||
KeyCode::Right => {
|
||||
format!("{}\u{2192}", get_modifier_hint(ev.modifiers)) //→
|
||||
}
|
||||
KeyCode::Up => {
|
||||
format!("{}\u{2191}", get_modifier_hint(ev.modifiers)) //↑
|
||||
}
|
||||
KeyCode::Down => {
|
||||
format!("{}\u{2193}", get_modifier_hint(ev.modifiers)) //↓
|
||||
}
|
||||
KeyCode::Backspace => {
|
||||
format!("{}\u{232b}", get_modifier_hint(ev.modifiers)) //⌫
|
||||
}
|
||||
KeyCode::Home => {
|
||||
format!("{}\u{2912}", get_modifier_hint(ev.modifiers)) //⤒
|
||||
}
|
||||
KeyCode::End => {
|
||||
format!("{}\u{2913}", get_modifier_hint(ev.modifiers)) //⤓
|
||||
}
|
||||
KeyCode::PageUp => {
|
||||
format!("{}\u{21de}", get_modifier_hint(ev.modifiers)) //⇞
|
||||
}
|
||||
KeyCode::PageDown => {
|
||||
format!("{}\u{21df}", get_modifier_hint(ev.modifiers)) //⇟
|
||||
}
|
||||
KeyCode::Tab => {
|
||||
format!("{}\u{21e5}", get_modifier_hint(ev.modifiers)) //⇥
|
||||
}
|
||||
KeyCode::BackTab => {
|
||||
format!("{}\u{21e4}", get_modifier_hint(ev.modifiers)) //⇤
|
||||
}
|
||||
KeyCode::Delete => {
|
||||
format!("{}\u{2326}", get_modifier_hint(ev.modifiers)) //⌦
|
||||
}
|
||||
KeyCode::Insert => {
|
||||
format!("{}\u{2380}", get_modifier_hint(ev.modifiers)) //⎀
|
||||
}
|
||||
KeyCode::Esc => {
|
||||
format!("{}\u{238b}", get_modifier_hint(ev.modifiers)) //⎋
|
||||
}
|
||||
KeyCode::F(u) => {
|
||||
format!("{}F{}", get_modifier_hint(ev.modifiers), u)
|
||||
}
|
||||
KeyCode::Null => get_modifier_hint(ev.modifiers),
|
||||
}
|
||||
}
|
||||
|
||||
fn get_modifier_hint(modifier: KeyModifiers) -> String {
|
||||
match modifier {
|
||||
KeyModifiers::CONTROL => "^".to_string(),
|
||||
KeyModifiers::SHIFT => {
|
||||
"\u{21e7}".to_string() //⇧
|
||||
pub fn get_hint(&self, ev: KeyEvent) -> String {
|
||||
match ev.code {
|
||||
KeyCode::Down
|
||||
| KeyCode::Up
|
||||
| KeyCode::Right
|
||||
| KeyCode::Left
|
||||
| KeyCode::Enter
|
||||
| KeyCode::Backspace
|
||||
| KeyCode::Home
|
||||
| KeyCode::End
|
||||
| KeyCode::PageUp
|
||||
| KeyCode::PageDown
|
||||
| KeyCode::Tab
|
||||
| KeyCode::BackTab
|
||||
| KeyCode::Delete
|
||||
| KeyCode::Insert
|
||||
| KeyCode::Esc => {
|
||||
format!(
|
||||
"{}{}",
|
||||
Self::get_modifier_hint(ev.modifiers),
|
||||
self.get_key_symbol(ev.code)
|
||||
)
|
||||
}
|
||||
KeyCode::Char(c) => {
|
||||
format!(
|
||||
"{}{}",
|
||||
Self::get_modifier_hint(ev.modifiers),
|
||||
c
|
||||
)
|
||||
}
|
||||
KeyCode::F(u) => {
|
||||
format!(
|
||||
"{}F{}",
|
||||
Self::get_modifier_hint(ev.modifiers),
|
||||
u
|
||||
)
|
||||
}
|
||||
KeyCode::Null => Self::get_modifier_hint(ev.modifiers),
|
||||
}
|
||||
KeyModifiers::ALT => {
|
||||
"\u{2325}".to_string() //⌥
|
||||
}
|
||||
|
||||
fn get_modifier_hint(modifier: KeyModifiers) -> String {
|
||||
match modifier {
|
||||
KeyModifiers::CONTROL => "^".to_string(),
|
||||
KeyModifiers::SHIFT => {
|
||||
"\u{21e7}".to_string() //⇧
|
||||
}
|
||||
KeyModifiers::ALT => {
|
||||
"\u{2325}".to_string() //⌥
|
||||
}
|
||||
_ => String::new(),
|
||||
}
|
||||
_ => String::new(),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{get_hint, KeyConfig};
|
||||
use super::KeyConfig;
|
||||
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
|
||||
|
||||
#[test]
|
||||
fn test_get_hint() {
|
||||
let h = get_hint(KeyEvent {
|
||||
let config = KeyConfig::default();
|
||||
let h = config.get_hint(KeyEvent {
|
||||
code: KeyCode::Char('c'),
|
||||
modifiers: KeyModifiers::CONTROL,
|
||||
});
|
||||
|
|
|
|||
245
src/strings.rs
245
src/strings.rs
|
|
@ -1,4 +1,4 @@
|
|||
use crate::keys::{get_hint, SharedKeyConfig};
|
||||
use crate::keys::SharedKeyConfig;
|
||||
|
||||
pub mod order {
|
||||
pub static NAV: i8 = 1;
|
||||
|
|
@ -15,26 +15,35 @@ pub static SELECT_BRANCH_POPUP_MSG: &str = "Switch Branch";
|
|||
pub fn title_status(key_config: &SharedKeyConfig) -> String {
|
||||
format!(
|
||||
"Unstaged Changes [{}]",
|
||||
get_hint(key_config.focus_workdir)
|
||||
key_config.get_hint(key_config.focus_workdir)
|
||||
)
|
||||
}
|
||||
pub fn title_diff(_key_config: &SharedKeyConfig) -> String {
|
||||
"Diff: ".to_string()
|
||||
}
|
||||
pub fn title_index(key_config: &SharedKeyConfig) -> String {
|
||||
format!("Staged Changes [{}]", get_hint(key_config.focus_stage))
|
||||
format!(
|
||||
"Staged Changes [{}]",
|
||||
key_config.get_hint(key_config.focus_stage)
|
||||
)
|
||||
}
|
||||
pub fn tab_status(key_config: &SharedKeyConfig) -> String {
|
||||
format!("Status [{}]", get_hint(key_config.tab_status))
|
||||
format!("Status [{}]", key_config.get_hint(key_config.tab_status))
|
||||
}
|
||||
pub fn tab_log(key_config: &SharedKeyConfig) -> String {
|
||||
format!("Log [{}]", get_hint(key_config.tab_log))
|
||||
format!("Log [{}]", key_config.get_hint(key_config.tab_log))
|
||||
}
|
||||
pub fn tab_stashing(key_config: &SharedKeyConfig) -> String {
|
||||
format!("Stashing [{}]", get_hint(key_config.tab_stashing))
|
||||
format!(
|
||||
"Stashing [{}]",
|
||||
key_config.get_hint(key_config.tab_stashing)
|
||||
)
|
||||
}
|
||||
pub fn tab_stashes(key_config: &SharedKeyConfig) -> String {
|
||||
format!("Stashes [{}]", get_hint(key_config.tab_stashes))
|
||||
format!(
|
||||
"Stashes [{}]",
|
||||
key_config.get_hint(key_config.tab_stashes)
|
||||
)
|
||||
}
|
||||
pub fn tab_divider(_key_config: &SharedKeyConfig) -> String {
|
||||
" | ".to_string()
|
||||
|
|
@ -201,7 +210,7 @@ pub mod commit {
|
|||
|
||||
pub mod commands {
|
||||
use crate::components::CommandText;
|
||||
use crate::keys::{get_hint, SharedKeyConfig};
|
||||
use crate::keys::SharedKeyConfig;
|
||||
|
||||
static CMD_GROUP_GENERAL: &str = "-- General --";
|
||||
static CMD_GROUP_DIFF: &str = "-- Diff --";
|
||||
|
|
@ -213,7 +222,10 @@ pub mod commands {
|
|||
|
||||
pub fn toggle_tabs(key_config: &SharedKeyConfig) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Next [{}]", get_hint(key_config.tab_toggle)),
|
||||
format!(
|
||||
"Next [{}]",
|
||||
key_config.get_hint(key_config.tab_toggle)
|
||||
),
|
||||
"switch to next tab",
|
||||
CMD_GROUP_GENERAL,
|
||||
)
|
||||
|
|
@ -224,10 +236,10 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"Tab [{}{}{}{}]",
|
||||
get_hint(key_config.tab_status),
|
||||
get_hint(key_config.tab_log),
|
||||
get_hint(key_config.tab_stashing),
|
||||
get_hint(key_config.tab_stashes),
|
||||
key_config.get_hint(key_config.tab_status),
|
||||
key_config.get_hint(key_config.tab_log),
|
||||
key_config.get_hint(key_config.tab_stashing),
|
||||
key_config.get_hint(key_config.tab_stashes),
|
||||
),
|
||||
"switch top level tabs directly",
|
||||
CMD_GROUP_GENERAL,
|
||||
|
|
@ -235,7 +247,10 @@ pub mod commands {
|
|||
}
|
||||
pub fn help_open(key_config: &SharedKeyConfig) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Help [{}]", get_hint(key_config.open_help)),
|
||||
format!(
|
||||
"Help [{}]",
|
||||
key_config.get_hint(key_config.open_help)
|
||||
),
|
||||
"open this help screen",
|
||||
CMD_GROUP_GENERAL,
|
||||
)
|
||||
|
|
@ -246,8 +261,8 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"Nav [{}{}]",
|
||||
get_hint(key_config.move_up),
|
||||
get_hint(key_config.move_down)
|
||||
key_config.get_hint(key_config.move_up),
|
||||
key_config.get_hint(key_config.move_down)
|
||||
),
|
||||
"navigate commit message",
|
||||
CMD_GROUP_GENERAL,
|
||||
|
|
@ -259,10 +274,10 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"Nav [{}{}{}{}]",
|
||||
get_hint(key_config.move_up),
|
||||
get_hint(key_config.move_down),
|
||||
get_hint(key_config.move_right),
|
||||
get_hint(key_config.move_left)
|
||||
key_config.get_hint(key_config.move_up),
|
||||
key_config.get_hint(key_config.move_down),
|
||||
key_config.get_hint(key_config.move_right),
|
||||
key_config.get_hint(key_config.move_left)
|
||||
),
|
||||
"navigate tree view",
|
||||
CMD_GROUP_GENERAL,
|
||||
|
|
@ -272,8 +287,8 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"Scroll [{}{}]",
|
||||
get_hint(key_config.focus_above),
|
||||
get_hint(key_config.focus_below)
|
||||
key_config.get_hint(key_config.focus_above),
|
||||
key_config.get_hint(key_config.focus_below)
|
||||
),
|
||||
"scroll up or down in focused view",
|
||||
CMD_GROUP_GENERAL,
|
||||
|
|
@ -281,14 +296,20 @@ pub mod commands {
|
|||
}
|
||||
pub fn copy(key_config: &SharedKeyConfig) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Copy [{}]", get_hint(key_config.copy),),
|
||||
format!(
|
||||
"Copy [{}]",
|
||||
key_config.get_hint(key_config.copy),
|
||||
),
|
||||
"copy selected lines to clipboard",
|
||||
CMD_GROUP_DIFF,
|
||||
)
|
||||
}
|
||||
pub fn copy_hash(key_config: &SharedKeyConfig) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Copy Hash [{}]", get_hint(key_config.copy),),
|
||||
format!(
|
||||
"Copy Hash [{}]",
|
||||
key_config.get_hint(key_config.copy),
|
||||
),
|
||||
"copy selected commit hash to clipboard",
|
||||
CMD_GROUP_DIFF,
|
||||
)
|
||||
|
|
@ -299,10 +320,10 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"Jump up/down [{},{},{},{}]",
|
||||
get_hint(key_config.home),
|
||||
get_hint(key_config.end),
|
||||
get_hint(key_config.move_up),
|
||||
get_hint(key_config.move_down)
|
||||
key_config.get_hint(key_config.home),
|
||||
key_config.get_hint(key_config.end),
|
||||
key_config.get_hint(key_config.move_up),
|
||||
key_config.get_hint(key_config.move_down)
|
||||
),
|
||||
"scroll to top or bottom of diff",
|
||||
CMD_GROUP_DIFF,
|
||||
|
|
@ -312,7 +333,10 @@ pub mod commands {
|
|||
key_config: &SharedKeyConfig,
|
||||
) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Add hunk [{}]", get_hint(key_config.enter),),
|
||||
format!(
|
||||
"Add hunk [{}]",
|
||||
key_config.get_hint(key_config.enter),
|
||||
),
|
||||
"adds selected hunk to stage",
|
||||
CMD_GROUP_DIFF,
|
||||
)
|
||||
|
|
@ -323,7 +347,7 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"Revert hunk [{}]",
|
||||
get_hint(key_config.status_reset_item),
|
||||
key_config.get_hint(key_config.status_reset_item),
|
||||
),
|
||||
"reverts selected hunk",
|
||||
CMD_GROUP_DIFF,
|
||||
|
|
@ -333,21 +357,30 @@ pub mod commands {
|
|||
key_config: &SharedKeyConfig,
|
||||
) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Remove hunk [{}]", get_hint(key_config.enter),),
|
||||
format!(
|
||||
"Remove hunk [{}]",
|
||||
key_config.get_hint(key_config.enter),
|
||||
),
|
||||
"removes selected hunk from stage",
|
||||
CMD_GROUP_DIFF,
|
||||
)
|
||||
}
|
||||
pub fn close_popup(key_config: &SharedKeyConfig) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Close [{}]", get_hint(key_config.exit_popup),),
|
||||
format!(
|
||||
"Close [{}]",
|
||||
key_config.get_hint(key_config.exit_popup),
|
||||
),
|
||||
"close overlay (e.g commit, help)",
|
||||
CMD_GROUP_GENERAL,
|
||||
)
|
||||
}
|
||||
pub fn close_msg(key_config: &SharedKeyConfig) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Close [{}]", get_hint(key_config.enter),),
|
||||
format!(
|
||||
"Close [{}]",
|
||||
key_config.get_hint(key_config.enter),
|
||||
),
|
||||
"close msg popup (e.g msg)",
|
||||
CMD_GROUP_GENERAL,
|
||||
)
|
||||
|
|
@ -355,7 +388,10 @@ pub mod commands {
|
|||
}
|
||||
pub fn validate_msg(key_config: &SharedKeyConfig) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Validate [{}]", get_hint(key_config.enter),),
|
||||
format!(
|
||||
"Validate [{}]",
|
||||
key_config.get_hint(key_config.enter),
|
||||
),
|
||||
"validate msg",
|
||||
CMD_GROUP_GENERAL,
|
||||
)
|
||||
|
|
@ -367,7 +403,7 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"To stage [{}]",
|
||||
get_hint(key_config.focus_stage),
|
||||
key_config.get_hint(key_config.focus_stage),
|
||||
),
|
||||
"focus/select staging area",
|
||||
CMD_GROUP_GENERAL,
|
||||
|
|
@ -379,8 +415,8 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"To files [{},{}]",
|
||||
get_hint(key_config.tab_status),
|
||||
get_hint(key_config.tab_log),
|
||||
key_config.get_hint(key_config.tab_status),
|
||||
key_config.get_hint(key_config.tab_log),
|
||||
),
|
||||
"focus/select file tree of staged or unstaged files",
|
||||
CMD_GROUP_GENERAL,
|
||||
|
|
@ -392,7 +428,7 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"To unstaged [{}]",
|
||||
get_hint(key_config.focus_workdir),
|
||||
key_config.get_hint(key_config.focus_workdir),
|
||||
),
|
||||
"focus/select unstaged area",
|
||||
CMD_GROUP_GENERAL,
|
||||
|
|
@ -400,7 +436,10 @@ pub mod commands {
|
|||
}
|
||||
pub fn commit_open(key_config: &SharedKeyConfig) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Commit [{}]", get_hint(key_config.open_commit),),
|
||||
format!(
|
||||
"Commit [{}]",
|
||||
key_config.get_hint(key_config.open_commit),
|
||||
),
|
||||
"open commit popup (available in non-empty stage)",
|
||||
CMD_GROUP_COMMIT,
|
||||
)
|
||||
|
|
@ -411,7 +450,7 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"Open editor [{}]",
|
||||
get_hint(key_config.open_commit_editor),
|
||||
key_config.get_hint(key_config.open_commit_editor),
|
||||
),
|
||||
"open commit editor (available in non-empty stage)",
|
||||
CMD_GROUP_COMMIT,
|
||||
|
|
@ -419,28 +458,40 @@ pub mod commands {
|
|||
}
|
||||
pub fn commit_enter(key_config: &SharedKeyConfig) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Commit [{}]", get_hint(key_config.enter),),
|
||||
format!(
|
||||
"Commit [{}]",
|
||||
key_config.get_hint(key_config.enter),
|
||||
),
|
||||
"commit (available when commit message is non-empty)",
|
||||
CMD_GROUP_COMMIT,
|
||||
)
|
||||
}
|
||||
pub fn commit_amend(key_config: &SharedKeyConfig) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Amend [{}]", get_hint(key_config.commit_amend),),
|
||||
format!(
|
||||
"Amend [{}]",
|
||||
key_config.get_hint(key_config.commit_amend),
|
||||
),
|
||||
"amend last commit",
|
||||
CMD_GROUP_COMMIT,
|
||||
)
|
||||
}
|
||||
pub fn edit_item(key_config: &SharedKeyConfig) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Edit Item [{}]", get_hint(key_config.edit_file),),
|
||||
format!(
|
||||
"Edit Item [{}]",
|
||||
key_config.get_hint(key_config.edit_file),
|
||||
),
|
||||
"edit the currently selected file in an external editor",
|
||||
CMD_GROUP_CHANGES,
|
||||
)
|
||||
}
|
||||
pub fn stage_item(key_config: &SharedKeyConfig) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Stage Item [{}]", get_hint(key_config.enter),),
|
||||
format!(
|
||||
"Stage Item [{}]",
|
||||
key_config.get_hint(key_config.enter),
|
||||
),
|
||||
"stage currently selected file or entire path",
|
||||
CMD_GROUP_CHANGES,
|
||||
)
|
||||
|
|
@ -449,7 +500,7 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"Stage All [{}]",
|
||||
get_hint(key_config.status_stage_all),
|
||||
key_config.get_hint(key_config.status_stage_all),
|
||||
),
|
||||
"stage all changes (in unstaged files)",
|
||||
CMD_GROUP_CHANGES,
|
||||
|
|
@ -457,7 +508,10 @@ pub mod commands {
|
|||
}
|
||||
pub fn unstage_item(key_config: &SharedKeyConfig) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Unstage Item [{}]", get_hint(key_config.enter),),
|
||||
format!(
|
||||
"Unstage Item [{}]",
|
||||
key_config.get_hint(key_config.enter),
|
||||
),
|
||||
"unstage currently selected file or entire path",
|
||||
CMD_GROUP_CHANGES,
|
||||
)
|
||||
|
|
@ -466,7 +520,7 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"Unstage all [{}]",
|
||||
get_hint(key_config.status_stage_all),
|
||||
key_config.get_hint(key_config.status_stage_all),
|
||||
),
|
||||
"unstage all files (in staged files)",
|
||||
CMD_GROUP_CHANGES,
|
||||
|
|
@ -476,7 +530,7 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"Reset Item [{}]",
|
||||
get_hint(key_config.stash_drop),
|
||||
key_config.get_hint(key_config.stash_drop),
|
||||
),
|
||||
"revert changes in selected file or entire path",
|
||||
CMD_GROUP_CHANGES,
|
||||
|
|
@ -486,7 +540,7 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"Ignore [{}]",
|
||||
get_hint(key_config.status_ignore_file),
|
||||
key_config.get_hint(key_config.status_ignore_file),
|
||||
),
|
||||
"Add file or path to .gitignore",
|
||||
CMD_GROUP_CHANGES,
|
||||
|
|
@ -497,7 +551,10 @@ pub mod commands {
|
|||
key_config: &SharedKeyConfig,
|
||||
) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Back [{}]", get_hint(key_config.focus_left),),
|
||||
format!(
|
||||
"Back [{}]",
|
||||
key_config.get_hint(key_config.focus_left),
|
||||
),
|
||||
"view and select changed files",
|
||||
CMD_GROUP_GENERAL,
|
||||
)
|
||||
|
|
@ -506,14 +563,20 @@ pub mod commands {
|
|||
key_config: &SharedKeyConfig,
|
||||
) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Diff [{}]", get_hint(key_config.focus_right),),
|
||||
format!(
|
||||
"Diff [{}]",
|
||||
key_config.get_hint(key_config.focus_right),
|
||||
),
|
||||
"inspect file diff",
|
||||
CMD_GROUP_GENERAL,
|
||||
)
|
||||
}
|
||||
pub fn quit(key_config: &SharedKeyConfig) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Quit [{}]", get_hint(key_config.exit),),
|
||||
format!(
|
||||
"Quit [{}]",
|
||||
key_config.get_hint(key_config.exit),
|
||||
),
|
||||
"quit gitui application",
|
||||
CMD_GROUP_GENERAL,
|
||||
)
|
||||
|
|
@ -522,7 +585,10 @@ pub mod commands {
|
|||
key_config: &SharedKeyConfig,
|
||||
) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Confirm [{}]", get_hint(key_config.enter),),
|
||||
format!(
|
||||
"Confirm [{}]",
|
||||
key_config.get_hint(key_config.enter),
|
||||
),
|
||||
"resets the file in question",
|
||||
CMD_GROUP_GENERAL,
|
||||
)
|
||||
|
|
@ -531,7 +597,10 @@ pub mod commands {
|
|||
key_config: &SharedKeyConfig,
|
||||
) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Save [{}]", get_hint(key_config.stashing_save),),
|
||||
format!(
|
||||
"Save [{}]",
|
||||
key_config.get_hint(key_config.stashing_save),
|
||||
),
|
||||
"opens stash name input popup",
|
||||
CMD_GROUP_STASHING,
|
||||
)
|
||||
|
|
@ -542,7 +611,7 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"Toggle Staged [{}]",
|
||||
get_hint(key_config.stashing_toggle_index),
|
||||
key_config.get_hint(key_config.stashing_toggle_index),
|
||||
),
|
||||
"toggle including staged files into stash",
|
||||
CMD_GROUP_STASHING,
|
||||
|
|
@ -554,7 +623,8 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"Toggle Untracked [{}]",
|
||||
get_hint(key_config.stashing_toggle_untracked),
|
||||
key_config
|
||||
.get_hint(key_config.stashing_toggle_untracked),
|
||||
),
|
||||
"toggle including untracked files into stash",
|
||||
CMD_GROUP_STASHING,
|
||||
|
|
@ -564,7 +634,10 @@ pub mod commands {
|
|||
key_config: &SharedKeyConfig,
|
||||
) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Stash [{}]", get_hint(key_config.enter),),
|
||||
format!(
|
||||
"Stash [{}]",
|
||||
key_config.get_hint(key_config.enter),
|
||||
),
|
||||
"save files to stash",
|
||||
CMD_GROUP_STASHING,
|
||||
)
|
||||
|
|
@ -573,7 +646,10 @@ pub mod commands {
|
|||
key_config: &SharedKeyConfig,
|
||||
) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Apply [{}]", get_hint(key_config.enter),),
|
||||
format!(
|
||||
"Apply [{}]",
|
||||
key_config.get_hint(key_config.enter),
|
||||
),
|
||||
"apply selected stash",
|
||||
CMD_GROUP_STASHES,
|
||||
)
|
||||
|
|
@ -582,7 +658,10 @@ pub mod commands {
|
|||
key_config: &SharedKeyConfig,
|
||||
) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Drop [{}]", get_hint(key_config.stash_drop),),
|
||||
format!(
|
||||
"Drop [{}]",
|
||||
key_config.get_hint(key_config.stash_drop),
|
||||
),
|
||||
"drop selected stash",
|
||||
CMD_GROUP_STASHES,
|
||||
)
|
||||
|
|
@ -591,7 +670,10 @@ pub mod commands {
|
|||
key_config: &SharedKeyConfig,
|
||||
) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Inspect [{}]", get_hint(key_config.focus_right),),
|
||||
format!(
|
||||
"Inspect [{}]",
|
||||
key_config.get_hint(key_config.focus_right),
|
||||
),
|
||||
"open stash commit details (allows to diff files)",
|
||||
CMD_GROUP_STASHES,
|
||||
)
|
||||
|
|
@ -600,7 +682,10 @@ pub mod commands {
|
|||
key_config: &SharedKeyConfig,
|
||||
) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Details [{}]", get_hint(key_config.enter),),
|
||||
format!(
|
||||
"Details [{}]",
|
||||
key_config.get_hint(key_config.enter),
|
||||
),
|
||||
"open details of selected commit",
|
||||
CMD_GROUP_LOG,
|
||||
)
|
||||
|
|
@ -609,7 +694,10 @@ pub mod commands {
|
|||
key_config: &SharedKeyConfig,
|
||||
) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Inspect [{}]", get_hint(key_config.focus_right),),
|
||||
format!(
|
||||
"Inspect [{}]",
|
||||
key_config.get_hint(key_config.focus_right),
|
||||
),
|
||||
"inspect selected commit in detail",
|
||||
CMD_GROUP_LOG,
|
||||
)
|
||||
|
|
@ -618,7 +706,10 @@ pub mod commands {
|
|||
key_config: &SharedKeyConfig,
|
||||
) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Tag [{}]", get_hint(key_config.log_tag_commit),),
|
||||
format!(
|
||||
"Tag [{}]",
|
||||
key_config.get_hint(key_config.log_tag_commit),
|
||||
),
|
||||
"tag commit",
|
||||
CMD_GROUP_LOG,
|
||||
)
|
||||
|
|
@ -627,7 +718,10 @@ pub mod commands {
|
|||
key_config: &SharedKeyConfig,
|
||||
) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Tag [{}]", get_hint(key_config.enter),),
|
||||
format!(
|
||||
"Tag [{}]",
|
||||
key_config.get_hint(key_config.enter),
|
||||
),
|
||||
"tag commit",
|
||||
CMD_GROUP_LOG,
|
||||
)
|
||||
|
|
@ -636,7 +730,10 @@ pub mod commands {
|
|||
key_config: &SharedKeyConfig,
|
||||
) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Create Branch [{}]", get_hint(key_config.enter),),
|
||||
format!(
|
||||
"Create Branch [{}]",
|
||||
key_config.get_hint(key_config.enter),
|
||||
),
|
||||
"create branch",
|
||||
CMD_GROUP_GENERAL,
|
||||
)
|
||||
|
|
@ -647,7 +744,7 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"Create [{}]",
|
||||
get_hint(key_config.create_branch),
|
||||
key_config.get_hint(key_config.create_branch),
|
||||
),
|
||||
"open create branch popup",
|
||||
CMD_GROUP_GENERAL,
|
||||
|
|
@ -657,7 +754,10 @@ pub mod commands {
|
|||
key_config: &SharedKeyConfig,
|
||||
) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Rename Branch [{}]", get_hint(key_config.enter),),
|
||||
format!(
|
||||
"Rename Branch [{}]",
|
||||
key_config.get_hint(key_config.enter),
|
||||
),
|
||||
"rename branch",
|
||||
CMD_GROUP_GENERAL,
|
||||
)
|
||||
|
|
@ -668,7 +768,7 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"Rename Branch [{}]",
|
||||
get_hint(key_config.rename_branch),
|
||||
key_config.get_hint(key_config.rename_branch),
|
||||
),
|
||||
"rename branch",
|
||||
CMD_GROUP_GENERAL,
|
||||
|
|
@ -680,7 +780,7 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"Delete [{}]",
|
||||
get_hint(key_config.delete_branch),
|
||||
key_config.get_hint(key_config.delete_branch),
|
||||
),
|
||||
"delete a branch",
|
||||
CMD_GROUP_GENERAL,
|
||||
|
|
@ -692,7 +792,7 @@ pub mod commands {
|
|||
CommandText::new(
|
||||
format!(
|
||||
"Branches [{}]",
|
||||
get_hint(key_config.select_branch),
|
||||
key_config.get_hint(key_config.select_branch),
|
||||
),
|
||||
"open select branch popup",
|
||||
CMD_GROUP_GENERAL,
|
||||
|
|
@ -701,7 +801,10 @@ pub mod commands {
|
|||
|
||||
pub fn status_push(key_config: &SharedKeyConfig) -> CommandText {
|
||||
CommandText::new(
|
||||
format!("Push [{}]", get_hint(key_config.push),),
|
||||
format!(
|
||||
"Push [{}]",
|
||||
key_config.get_hint(key_config.push),
|
||||
),
|
||||
"push to origin",
|
||||
CMD_GROUP_GENERAL,
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue