mirror of
https://github.com/nushell/nushell.git
synced 2024-11-27 10:53:57 +01:00
Make the validation especific to str plugin for now.
This commit is contained in:
parent
d1399c0c0c
commit
87b299739c
@ -5,14 +5,6 @@ use std::io;
|
||||
pub trait Plugin {
|
||||
fn config(&mut self) -> Result<CommandConfig, ShellError>;
|
||||
|
||||
#[allow(unused)]
|
||||
fn is_valid(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
fn log_error(&mut self, message: &str) { }
|
||||
|
||||
#[allow(unused)]
|
||||
fn begin_filter(&mut self, call_info: CallInfo) -> Result<Vec<ReturnValue>, ShellError> {
|
||||
Ok(vec![])
|
||||
|
@ -21,6 +21,14 @@ impl Str {
|
||||
}
|
||||
}
|
||||
|
||||
fn is_valid(&self) -> bool {
|
||||
(self.downcase && !self.upcase) || (!self.downcase && self.upcase)
|
||||
}
|
||||
|
||||
fn log_error(&mut self, message: &str) {
|
||||
self.error = Some(message.to_string());
|
||||
}
|
||||
|
||||
fn to_downcase(&mut self) {
|
||||
self.downcase = true;
|
||||
|
||||
@ -107,14 +115,6 @@ impl Plugin for Str {
|
||||
})
|
||||
}
|
||||
|
||||
fn is_valid(&self) -> bool {
|
||||
(self.downcase && !self.upcase) || (!self.downcase && self.upcase)
|
||||
}
|
||||
|
||||
fn log_error(&mut self, message: &str) {
|
||||
self.error = Some(message.to_string());
|
||||
}
|
||||
|
||||
fn begin_filter(&mut self, call_info: CallInfo) -> Result<Vec<ReturnValue>, ShellError> {
|
||||
if call_info.args.has("downcase") {
|
||||
self.to_downcase();
|
||||
|
Loading…
Reference in New Issue
Block a user