fish: use fish_indent on functions

This commit is contained in:
Charles Gould 2020-03-27 20:31:49 -05:00
parent 3c0ad26e4b
commit 737cbd0d9a
5 changed files with 18 additions and 18 deletions

View File

@ -7,7 +7,7 @@ function battery
set --local battery_status (pmset -g batt | string split0) set --local battery_status (pmset -g batt | string split0)
set --local battery_charge (echo $battery_status | rg --only-matching "\d+%") set --local battery_charge (echo $battery_status | rg --only-matching "\d+%")
set --local power_source (echo $battery_status | rg --only-matching "[A-Za-z]+\sPower") set --local power_source (echo $battery_status | rg --only-matching "[A-Za-z]+\sPower")
set_color green set_color green
echo "⚡️ Running on $power_source with $battery_charge charge" echo "⚡️ Running on $power_source with $battery_charge charge"

View File

@ -3,10 +3,10 @@ function confirm --description "Ask for user confirmation"
read --local --prompt-str='Are you sure you want to continue? [y/N] ' confirmed read --local --prompt-str='Are you sure you want to continue? [y/N] ' confirmed
switch $confirmed switch $confirmed
case Y y case Y y
return 0 return 0
case '' N n case '' N n
return 1 return 1
end end
end end
end end

View File

@ -1,8 +1,8 @@
function dns_flush function dns_flush
switch (uname -s) switch (uname -s)
case Darwin case Darwin
sudo killall -HUP mDNSResponder sudo killall -HUP mDNSResponder
case '*' case '*'
echo "Unsupported kernel: "(uname -s) echo "Unsupported kernel: "(uname -s)
end end
end end

View File

@ -5,12 +5,12 @@ function fbrew --description "Fuzzy homebrew"
end end
switch $argv[1] switch $argv[1]
case i install case i install
_fbrew_install $argv[2..-1] _fbrew_install $argv[2..-1]
case u uninstall case u uninstall
_fbrew_uninstall $argv[2..-1] _fbrew_uninstall $argv[2..-1]
case '*' case '*'
echo "Unsupported command: $argv[1]" echo "Unsupported command: $argv[1]"
end end
end end
@ -47,7 +47,7 @@ function _fbrew_uninstall
set --local uninst_pkgs_all $uninst_pkgs set --local uninst_pkgs_all $uninst_pkgs
set --local locked_pkgs_all $locked_pkgs set --local locked_pkgs_all $locked_pkgs
for bdi in $brew_deps_installed for bdi in $brew_deps_installed
set --local pkg (string split ':' $bdi | head -n 1) set --local pkg (string split ':' $bdi | head -n 1)
set --local deps (string split ' ' (string split ':' $bdi | tail -n +2)) set --local deps (string split ' ' (string split ':' $bdi | tail -n +2))
if contains -- $pkg $uninst_pkgs if contains -- $pkg $uninst_pkgs
for dep in $deps for dep in $deps
@ -72,7 +72,7 @@ function _fbrew_uninstall
# Don't uninstall dependencies of other installed packages # Don't uninstall dependencies of other installed packages
set --local uninst_pkgs_final $uninst_pkgs_all set --local uninst_pkgs_final $uninst_pkgs_all
for bdi in $brew_deps_installed for bdi in $brew_deps_installed
set --local pkg (string split ':' $bdi | head -n 1) set --local pkg (string split ':' $bdi | head -n 1)
set --local deps (string split ' ' (string split ':' $bdi | tail -n +2)) set --local deps (string split ' ' (string split ':' $bdi | tail -n +2))
if not contains -- $pkg $uninst_pkgs_all if not contains -- $pkg $uninst_pkgs_all
for dep in $deps for dep in $deps

View File

@ -14,7 +14,7 @@ function video_compress --argument-names srcfile
# Output: srcfile.extension -> srcfile-compressed.mp4 # Output: srcfile.extension -> srcfile-compressed.mp4
set --local dstfile (string split -r -m1 . $srcfile)[1]-compressed.mp4 set --local dstfile (string split -r -m1 . $srcfile)[1]-compressed.mp4
set --local preset 'Vimeo YouTube HQ 720p60' set --local preset 'Vimeo YouTube HQ 720p60'
HandBrakeCLI --preset $preset --input $srcfile --output $dstfile HandBrakeCLI --preset $preset --input $srcfile --output $dstfile
end end