1use super::Shell;
2use std::path::Path;
3
4#[derive(Debug)]
5pub struct Fish;
6
7impl Shell for Fish {
8 fn path(&self, path: &Path, append: bool) -> String {
9 if append {
10 return format!("set -gx PATH $PATH {:?};", path.display());
11 }
12
13 format!("set -gx PATH {:?} $PATH;", path.display())
14 }
15
16 fn env_var(&self, name: &str, value: &str) -> String {
17 format!("set -gx {name} {value:?};", name = name, value = value)
18 }
19
20 fn use_on_cd(&self) -> &'static str {
21 indoc::indoc!(
22 r#"
23 function _snm_autoload_hook --on-variable PWD --description 'Change Node version on directory change'
24 status --is-command-substitution; and return
25 if test -f .node-version -o -f .nvmrc -o -f package.json
26 snm use
27 end
28 end
29 "#
30 )
31 }
32}