diff options
| author | Fuwn <[email protected]> | 2021-05-20 17:05:59 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-20 17:05:59 +0000 |
| commit | 9dbc613765de8ab7dfa8e1374cf6661dcfd56bc8 (patch) | |
| tree | 8cfff6a23bb72db2660e68c63a8cf9d0539a061f /crates/whirl_prompt/src/builtins/structures.rs | |
| parent | feat(readme): add sqlfluff as a dev dep (diff) | |
| download | whirl-9dbc613765de8ab7dfa8e1374cf6661dcfd56bc8.tar.xz whirl-9dbc613765de8ab7dfa8e1374cf6661dcfd56bc8.zip | |
refactor(global): move crates around, stricter module isolation
Diffstat (limited to 'crates/whirl_prompt/src/builtins/structures.rs')
| -rw-r--r-- | crates/whirl_prompt/src/builtins/structures.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/crates/whirl_prompt/src/builtins/structures.rs b/crates/whirl_prompt/src/builtins/structures.rs new file mode 100644 index 0000000..4217a38 --- /dev/null +++ b/crates/whirl_prompt/src/builtins/structures.rs @@ -0,0 +1,34 @@ +// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective +// SPDX-License-Identifier: GPL-3.0-only + +use std::str::FromStr; + +pub enum BuiltIn { + Echo, + History, + Exit, + Null, + Help, + Ls, + Cat, + Config, + Fetch, +} +impl FromStr for BuiltIn { + type Err = (); + + fn from_str(s: &str) -> Result<Self, Self::Err> { + match s { + "echo" => Ok(BuiltIn::Echo), + "history" => Ok(BuiltIn::History), + "exit" => Ok(BuiltIn::Exit), + "null" => Ok(BuiltIn::Null), + "help" => Ok(BuiltIn::Help), + "ls" => Ok(BuiltIn::Ls), + "cat" => Ok(BuiltIn::Cat), + "config" => Ok(BuiltIn::Config), + "fetch" => Ok(BuiltIn::Fetch), + _ => Err(()), + } + } +} |