Skip to content

Instantly share code, notes, and snippets.

@d12frosted
Created May 1, 2015 14:07
Show Gist options
  • Save d12frosted/bcf4146bf486674c675c to your computer and use it in GitHub Desktop.
Save d12frosted/bcf4146bf486674c675c to your computer and use it in GitHub Desktop.
function f
set -l glob name "hello"
# for comment case
if something_true
do_the_thing
end
begin; do_not_ignore_inliners; end
begin; echo "1"; end; begin; echo "2"; end
begin; echo "1"; end; begin;
echo "2"; end
if something_true
do_the_true
else
do_the_false
end
if false; echo "true"; else
echo "false"
end
if false
echo "true"; else
echo "false"; end
if false
echo "true"; else
echo "false"
end
if is_it_true; echo "true"; else; echo "false"; end
true and begin
do_something
end
switch 10
case 0
echo "zero"
echo "really?"
case 42
echo "the answer"
case "*"
echo "what is it?"
end
switch 10
case 42; echo "the answer"
case "*"; echo "what is it?"
end
switch 10; case 42; echo "the answer"; case "*"; echo "what is it?"; end
switch 10; case "*"; echo "no-no"; end; switch 100
case 0
echo "zero"
case "*"
echo "default"
end
switch 10; case 42; echo "the answer"; case "*"
echo "what is it?"
end
switch 10; case 42; echo "the answer";
case "*"
echo "what is it?"
end
for option in $argv[3..-1]
true and switch $option
case ! -not
set operator $operator !
case -o -or
set operator -o
case -a -and
set operator -a
case "*"
if [ operator = ! ]
set glob $operator $glob
else
set glob $glob $operator
end
set glob $glob -name $option
set operator -o # Default
end
end
test -d $path
and for dir in (find $path \! -name "completions" -type d)
# Use head to retrieve at least one match. Skip not found errors
# for directories that do not exist.
if [ -z (find "$dir" $glob -maxdepth 1 ^/dev/null | head -1) ]
continue
end
# Print matched directories if the -v option is set.
if not [ -z $verbose ]
printf "%s\n" $dir
end
# Prepend matched directory to the the global fish function path.
# Note path duplicates are already handled by _prepend_path.
_prepend_path $dir -d fish_function_path
end
end
function1; and begin
function2
function3
end
@d12frosted
Copy link
Author

Dummy file for testing indentation rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment