From bac8a5d2822835cf47175d1162030653fadd5c09 Mon Sep 17 00:00:00 2001 From: johannst Date: Thu, 15 Feb 2024 23:29:57 +0000 Subject: deploy: 4485708c972815bbb6df7f5a228683aa855d553d --- tools/fish.html | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'tools/fish.html') 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 : when quoted or exported to the environment.

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
 

Command Handling

# sub-commands are not run in quotes
-echo "ls output: "(ls)
+echo "ls output: "(ls)
 

I/O redirection

# 'noclobber', fail if 'log' already exists
@@ -315,7 +315,7 @@ funced foo        # edit function 'foo'
 
  • Writing your own completions
  • complete
  • -
    function moose --d "my moose fn"
    +
    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"
     

    Prompt

    The prompt is defined by the output of the fish_prompt function.

    function fish_prompt
         set -l cmd_ret
    -    echo "> "(pwd) $cmd_ret" "
    +    echo "> "(pwd) $cmd_ret" "
     end
     
    @@ -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 -- cgit v1.2.3