feat(git): made SUCCESS/FAILURE emoji const
This puts the emoji for success/failure of a git operation into the strings module of utils. This might be handy down the line for implementing the disable emotes flag. Signed-off-by: Christina Sørensen <christina@cafkafk.com>
This commit is contained in:
parent
0660801014
commit
97d8ee52fc
5 changed files with 33 additions and 25 deletions
|
@ -1,3 +1,2 @@
|
|||
#!/usr/bin/env bash
|
||||
cargo rustc --release -- -C target-cpu=native
|
||||
cargo install --path .
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
- [ ] libgit2 (maybe)
|
||||
- [ ] Category Flags Finished
|
||||
- [ ] Implement Quiet flag
|
||||
- [ ] Implement no-emoji flag
|
||||
* 0.1.0 [80%] [4/5]
|
||||
- [X] No functionality regressions
|
||||
- [X] commit works in quick, fast
|
||||
|
@ -16,6 +17,6 @@
|
|||
- [X] Subcommands
|
||||
- [X] Quiet flag (wont rn)
|
||||
- [X] Do something about coc flag
|
||||
- [ ] UX
|
||||
- [ ] Change failure emotes
|
||||
- [-] UX
|
||||
- [X] Change failure emotes
|
||||
- [ ] Flag for disabling emotes
|
||||
|
|
14
src/git.rs
14
src/git.rs
|
@ -25,6 +25,8 @@ use std::os::unix::fs::symlink;
|
|||
use std::path::Path;
|
||||
use std::{fs, process::Command};
|
||||
|
||||
use crate::utils::strings::{FAILURE_EMOJI, SUCCESS_EMOJI};
|
||||
|
||||
/// An enum containing flags that change behaviour of repos and categories
|
||||
#[derive(PartialOrd, Ord, PartialEq, Eq, Serialize, Deserialize, Debug)]
|
||||
pub enum RepoFlags {
|
||||
|
@ -349,9 +351,9 @@ impl Config {
|
|||
for (_, repo) in category.repos.as_ref().expect("failed to get repos").iter() {
|
||||
let mut sp = Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op));
|
||||
if f(repo) {
|
||||
sp.stop_and_persist("✔", format!("{}: {}", repo.name, op));
|
||||
sp.stop_and_persist(SUCCESS_EMOJI, format!("{}: {}", repo.name, op));
|
||||
} else {
|
||||
sp.stop_and_persist("❎", format!("{}: {}", repo.name, op));
|
||||
sp.stop_and_persist(FAILURE_EMOJI, format!("{}: {}", repo.name, op));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -405,9 +407,9 @@ impl Config {
|
|||
let op = instruction.operation;
|
||||
let mut sp = Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op));
|
||||
if f(repo) {
|
||||
sp.stop_and_persist("✔", format!("{}: {}", repo.name, op));
|
||||
sp.stop_and_persist(SUCCESS_EMOJI, format!("{}: {}", repo.name, op));
|
||||
} else {
|
||||
sp.stop_and_persist("❎", format!("{}: {}", repo.name, op));
|
||||
sp.stop_and_persist(FAILURE_EMOJI, format!("{}: {}", repo.name, op));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -451,9 +453,9 @@ impl Config {
|
|||
let op = instruction.operation;
|
||||
let mut sp = Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op));
|
||||
if f(repo) {
|
||||
sp.stop_and_persist("✔", format!("{}: {}", repo.name, op));
|
||||
sp.stop_and_persist(SUCCESS_EMOJI, format!("{}: {}", repo.name, op));
|
||||
} else {
|
||||
sp.stop_and_persist("❎", format!("{}: {}", repo.name, op));
|
||||
sp.stop_and_persist(FAILURE_EMOJI, format!("{}: {}", repo.name, op));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,20 @@
|
|||
categories:
|
||||
utils:
|
||||
repos:
|
||||
li:
|
||||
name: li
|
||||
path: /home/ces/org/src/git/
|
||||
url: git@github.com:cafkafk/li.git
|
||||
flags:
|
||||
- Clone
|
||||
- Push
|
||||
gg:
|
||||
name: gg
|
||||
path: /home/ces/.dots/
|
||||
url: git@github.com:cafkafk/gg.git
|
||||
flags:
|
||||
- Clone
|
||||
- Push
|
||||
empty: {}
|
||||
stuff:
|
||||
flags: []
|
||||
|
@ -11,22 +27,6 @@ categories:
|
|||
name: gg
|
||||
path: /home/ces/.dots/
|
||||
url: git@github.com:cafkafk/gg.git
|
||||
utils:
|
||||
repos:
|
||||
gg:
|
||||
name: gg
|
||||
path: /home/ces/.dots/
|
||||
url: git@github.com:cafkafk/gg.git
|
||||
flags:
|
||||
- Clone
|
||||
- Push
|
||||
li:
|
||||
name: li
|
||||
path: /home/ces/org/src/git/
|
||||
url: git@github.com:cafkafk/li.git
|
||||
flags:
|
||||
- Clone
|
||||
- Push
|
||||
config:
|
||||
flags: []
|
||||
repos:
|
||||
|
|
|
@ -59,3 +59,9 @@ pub const QUICK_COMMIT: &str = "git: quick commit";
|
|||
|
||||
/// Contains the message for fast commit subcommand
|
||||
pub const FAST_COMMIT: &str = "git: fast commit";
|
||||
|
||||
/// Success emoji
|
||||
pub const SUCCESS_EMOJI: &str = "✔";
|
||||
|
||||
/// Failure emoji
|
||||
pub const FAILURE_EMOJI: &str = "❌";
|
||||
|
|
Loading…
Reference in a new issue