summaryrefslogtreecommitdiffstats
path: root/src/verb/verb_store.rs
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2020-09-29 16:56:46 +0200
committerCanop <cano.petrole@gmail.com>2020-09-29 16:56:46 +0200
commitc0b0b283dc2b24c3469339ebf61c28fda1e0efbb (patch)
treeca0dd838237e7a46e660d94f3f918fac4417ace5 /src/verb/verb_store.rs
parent46316405917f92e622cdb6e0b29dd769afb65206 (diff)
refactor verb initialization from conf
removing the useless step of VerbConf and VerbConfExecutionType
Diffstat (limited to 'src/verb/verb_store.rs')
-rw-r--r--src/verb/verb_store.rs22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/verb/verb_store.rs b/src/verb/verb_store.rs
index 73e86c1..e0c291a 100644
--- a/src/verb/verb_store.rs
+++ b/src/verb/verb_store.rs
@@ -1,7 +1,7 @@
use {
super::{
builtin::builtin_verbs,
- internal::Internal,
+ Internal,
Verb,
},
crate::{
@@ -10,7 +10,6 @@ use {
keys,
},
crossterm::event::KeyEvent,
- std::convert::TryFrom,
};
/// Provide access to the verbs:
@@ -33,20 +32,11 @@ pub enum PrefixSearchResult<'v, T> {
}
impl VerbStore {
- pub fn init(&mut self, conf: &Conf) {
- // we first add the verbs coming from configuration, as
- // we'll search in order. This way, a user can overload a
- // standard verb.
- for verb_conf in &conf.verbs {
- match Verb::try_from(verb_conf) {
- Ok(v) => {
- self.verbs.push(v);
- }
- Err(e) => {
- eprintln!("Verb error: {:?}", e);
- }
- }
- }
+ pub fn init(&mut self, conf: &mut Conf) {
+ // We first add the verbs coming from configuration, as we'll search in order.
+ // This way, a user can overload a standard verb.
+ // Note that we remove the verbs from conf, assuming they won't be needed anymore.
+ self.verbs.extend(conf.verbs.drain(..));
self.verbs.extend(builtin_verbs());
}