diff options
author | johannst <johannst@users.noreply.github.com> | 2024-02-15 23:29:57 +0000 |
---|---|---|
committer | johannst <johannst@users.noreply.github.com> | 2024-02-15 23:29:57 +0000 |
commit | bac8a5d2822835cf47175d1162030653fadd5c09 (patch) | |
tree | 28f312a114cf95ac799daac2a2caec4b8612d84d /tools/fish.html | |
parent | bfc5ce4bc01e5eb28969eefcc01ecfefa2601fdf (diff) | |
download | notes-bac8a5d2822835cf47175d1162030653fadd5c09.tar.gz notes-bac8a5d2822835cf47175d1162030653fadd5c09.zip |
deploy: 4485708c972815bbb6df7f5a228683aa855d553d
Diffstat (limited to 'tools/fish.html')
-rw-r--r-- | tools/fish.html | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/tools/fish.html b/tools/fish.html index 34faca9..26c920c 100644 --- a/tools/fish.html +++ b/tools/fish.html @@ -237,16 +237,16 @@ echo {a,b}{1,2} with <code>:</code> when quoted or exported to the environment.</p> <pre><code class="language-sh">set -x BLA_PATH a:b:c:d echo $BLA_PATH # a b c d -echo "$BLA_PATH" # a:b:c:d (quoted) +echo "$BLA_PATH" # a:b:c:d (quoted) env | grep BLA_PATH # BLA_PATH=a:b:c:d (env) set FOO_PATH x y z echo $FOO_PATH # x y z -echo "$FOO_PATH" # x:y:z +echo "$FOO_PATH" # x:y:z </code></pre> <h2 id="command-handling"><a class="header" href="#command-handling">Command Handling</a></h2> <pre><code class="language-sh"># sub-commands are not run in quotes -echo "ls output: "(ls) +echo "ls output: "(ls) </code></pre> <h3 id="io-redirection"><a class="header" href="#io-redirection">I/O redirection</a></h3> <pre><code class="language-sh"># 'noclobber', fail if 'log' already exists @@ -315,7 +315,7 @@ funced foo # edit function 'foo' <li><a href="https://fishshell.com/docs/current/completions.html">Writing your own completions</a></li> <li><a href="https://fishshell.com/docs/current/cmds/complete.html"><code>complete</code></a></li> </ul> -<pre><code class="language-sh">function moose --d "my moose fn" +<pre><code class="language-sh">function moose --d "my moose fn" # h/help : short / long option (boolean) # color : only long option (boolean) # u/user= : option with required argument, only last specified is taken @@ -325,18 +325,18 @@ funced foo # edit function 'foo' or return if set -ql _flag_help - echo "usage ..." + echo "usage ..." return 0 end set -ql _flag_file - and echo "file=$_flag_file | cnt:" (count $_flag_file) + and echo "file=$_flag_file | cnt:" (count $_flag_file) set -ql _flag_color - and echo "color=$_flag_color" + and echo "color=$_flag_color" set -ql _flag_user - and echo "user=$_flag_user" + and echo "user=$_flag_user" end # Delete all previous defined completions for 'moose'. @@ -348,31 +348,31 @@ complete -c moose --no-files # Help completion. # -n specifies a conditions. The completion is only active if the command # returns 0. -complete -c moose -s h -l help -n "not __fish_contains_opt -s h help" \ - --description "Print usage help and exit" +complete -c moose -s h -l help -n "not __fish_contains_opt -s h help" \ + --description "Print usage help and exit" # File completion. # -F force complete files (overwrite --no-files). # -r requires argument. complete -c moose -s f -l file -F -r \ - --description "Specify file (can be passed multiple times)" + --description "Specify file (can be passed multiple times)" # Color completion. # -a options for completion. # -x short for -r and --no-files (-f) -complete -c moose -x -l color -a "red blue" \ - --description "Specify a color." +complete -c moose -x -l color -a "red blue" \ + --description "Specify a color." # User completion. # -a options for completion. Call a function to generate arguments. -complete -c moose -x -s u -l user -a "(__fish_complete_users)" \ - --description "Specify a user" +complete -c moose -x -s u -l user -a "(__fish_complete_users)" \ + --description "Specify a user" </code></pre> <h2 id="prompt"><a class="header" href="#prompt">Prompt</a></h2> <p>The prompt is defined by the output of the <code>fish_prompt</code> function.</p> <pre><code class="language-sh">function fish_prompt set -l cmd_ret - echo "> "(pwd) $cmd_ret" " + echo "> "(pwd) $cmd_ret" " end </code></pre> <blockquote> @@ -397,7 +397,7 @@ string split SEP STRING # math math -b hex 4096 # output dec as hex math 0x1000 # output hex as dec -math "log2(1024)" # call functions +math "log2(1024)" # call functions math -s0 7/3 # integer division (by default float) # status |