From d9e390c738fad0c447c709003914e649c836921e Mon Sep 17 00:00:00 2001 From: Steve Calvert Date: Fri, 19 Oct 2018 16:19:59 -0700 Subject: [PATCH 1/2] [WIP] First pass at fish shell support --- crates/notion-core/src/shell/fish.rs | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 crates/notion-core/src/shell/fish.rs diff --git a/crates/notion-core/src/shell/fish.rs b/crates/notion-core/src/shell/fish.rs new file mode 100644 index 000000000..0d50237c9 --- /dev/null +++ b/crates/notion-core/src/shell/fish.rs @@ -0,0 +1,29 @@ +use std::path::{Path, PathBuf}; + +use super::{Postscript, Shell}; + +pub(crate) struct Fish { + pub(crate) postscript_path: PathBuf, +} + +impl Shell for Fish { + fn postscript_path(&self) -> &Path { + &self.postscript_path + } + + fn compile_postscript(&self, postscript: &Postscript) -> String { + match postscript { + &Postscript::Path(ref s) => { + format!("set -U fish_user_paths '{}'\n $fish_user_paths", s) + } + &Postscript::ToolVersion { + ref tool, + ref version, + } => format!( + "set -U NOTION_{}_VERSION {}\n", + tool.to_ascii_uppercase(), + version + ), + } + } +} From 63cb60c1f0ffc95614d65db1f269a97359ae6ec0 Mon Sep 17 00:00:00 2001 From: Steve Calvert Date: Sat, 20 Oct 2018 11:05:52 -0700 Subject: [PATCH 2/2] Change newline --- crates/notion-core/src/shell/fish.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/notion-core/src/shell/fish.rs b/crates/notion-core/src/shell/fish.rs index 0d50237c9..d1124d61d 100644 --- a/crates/notion-core/src/shell/fish.rs +++ b/crates/notion-core/src/shell/fish.rs @@ -14,7 +14,7 @@ impl Shell for Fish { fn compile_postscript(&self, postscript: &Postscript) -> String { match postscript { &Postscript::Path(ref s) => { - format!("set -U fish_user_paths '{}'\n $fish_user_paths", s) + format!("set -U fish_user_paths '{}' $fish_user_paths\n", s) } &Postscript::ToolVersion { ref tool,