Rename command "leave" to "keep", sounds more appropreate.

This commit is contained in:
Oleksandr Kozachuk
2023-01-03 16:25:29 +01:00
parent 538a32a471
commit 6f78130fab
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -104,7 +104,7 @@ impl<'a> LKEval<'a> {
} }
} }
pub fn cmd_leave(&self, out: &LKOut, name: &Name) { pub fn cmd_keep(&self, out: &LKOut, name: &Name) {
let pwd = match self.state.lock().borrow().ls.get(name) { let pwd = match self.state.lock().borrow().ls.get(name) {
Some(pwd) => pwd.clone(), Some(pwd) => pwd.clone(),
None => { None => {
+2 -2
View File
@@ -8,7 +8,7 @@ peg::parser! {
pub grammar command_parser() for str { pub grammar command_parser() for str {
pub rule cmd() -> Command<'input> = c:(info_cmd_list() / mod_cmd_list() / enc_cmd_list() / asides_cmd_list()) { c } pub rule cmd() -> Command<'input> = c:(info_cmd_list() / mod_cmd_list() / enc_cmd_list() / asides_cmd_list()) { c }
pub rule info_cmd_list() -> Command<'input> = space()* c:(ls_cmd() / ld_cmd() / pb_cmd() / save_cmd() / save_def_cmd() / dump_cmd()) { c } pub rule info_cmd_list() -> Command<'input> = space()* c:(ls_cmd() / ld_cmd() / pb_cmd() / save_cmd() / save_def_cmd() / dump_cmd()) { c }
pub rule mod_cmd_list() -> Command<'input> = space()* c:(add_cmd() / leave_cmd() / mv_cmd() / rm_cmd() / comment_cmd ()) { c } pub rule mod_cmd_list() -> Command<'input> = space()* c:(add_cmd() / keep_cmd() / mv_cmd() / rm_cmd() / comment_cmd ()) { c }
pub rule asides_cmd_list() -> Command<'input> = space()* c:(help_cmd() / source_cmd() / quit_cmd() / noop_cmd() / error_cmd()) { c } pub rule asides_cmd_list() -> Command<'input> = space()* c:(help_cmd() / source_cmd() / quit_cmd() / noop_cmd() / error_cmd()) { c }
pub rule enc_cmd_list() -> Command<'input> = space()* c:(enc_cmd() / gen_cmd() / pass_cmd() / unpass_cmd() / correct_cmd() / uncorrect_cmd()) { c } pub rule enc_cmd_list() -> Command<'input> = space()* c:(enc_cmd() / gen_cmd() / pass_cmd() / unpass_cmd() / correct_cmd() / uncorrect_cmd()) { c }
pub rule script() -> Vec<Command<'input>> = c:(info_cmd_list() / mod_cmd_list() / enc_cmd_list() / asides_cmd_list()) ++ "\n" { c } pub rule script() -> Vec<Command<'input>> = c:(info_cmd_list() / mod_cmd_list() / enc_cmd_list() / asides_cmd_list()) ++ "\n" { c }
@@ -89,7 +89,7 @@ peg::parser! {
rule ls_cmd() -> Command<'input> = "ls" f:comment()? { Command::Ls(f.unwrap_or(".".to_string())) } rule ls_cmd() -> Command<'input> = "ls" f:comment()? { Command::Ls(f.unwrap_or(".".to_string())) }
rule ld_cmd() -> Command<'input> = "ld" f:comment()? { Command::Ld(f.unwrap_or(".".to_string())) } rule ld_cmd() -> Command<'input> = "ld" f:comment()? { Command::Ld(f.unwrap_or(".".to_string())) }
rule add_cmd() -> Command<'input> = "add" _ name:name() { Command::Add(Password::from_password(name)) } rule add_cmd() -> Command<'input> = "add" _ name:name() { Command::Add(Password::from_password(name)) }
rule leave_cmd() -> Command<'input> = "leave" _ name:word() { Command::Leave(name.to_string()) } rule keep_cmd() -> Command<'input> = "keep" _ name:word() { Command::Keep(name.to_string()) }
rule gen_cmd() -> Command<'input> = "gen" n:num()? _ name:name() { rule gen_cmd() -> Command<'input> = "gen" n:num()? _ name:name() {
Command::Gen(match n { Some(n) => n, None => 10_u32 }, Password::from_password(name)) Command::Gen(match n { Some(n) => n, None => 10_u32 }, Password::from_password(name))
} }
+1 -1
View File
@@ -99,7 +99,7 @@ impl<'a> LKEval<'a> {
self.cmd_ls(&out, filter.to_string(), |a, b| a.lock().borrow().date.cmp(&b.lock().borrow().date)) self.cmd_ls(&out, filter.to_string(), |a, b| a.lock().borrow().date.cmp(&b.lock().borrow().date))
} }
Command::Add(name) => self.cmd_add(&out, &name), Command::Add(name) => self.cmd_add(&out, &name),
Command::Leave(name) => self.cmd_leave(&out, &name), Command::Keep(name) => self.cmd_keep(&out, &name),
Command::Comment(name, comment) => self.cmd_comment(&out, &name, &comment), Command::Comment(name, comment) => self.cmd_comment(&out, &name, &comment),
Command::Rm(name) => match self.get_password(name) { Command::Rm(name) => match self.get_password(name) {
Some(pwd) => { Some(pwd) => {
+1 -1
View File
@@ -60,7 +60,7 @@ pub enum LKErr<'a> {
#[derive(Debug)] #[derive(Debug)]
pub enum Command<'a> { pub enum Command<'a> {
Add(PasswordRef), Add(PasswordRef),
Leave(Name), Keep(Name),
Ls(String), Ls(String),
Ld(String), Ld(String),
Mv(Name, Name), Mv(Name, Name),