aboutsummaryrefslogtreecommitdiff
path: root/.config/fish/functions/bass.fish
diff options
context:
space:
mode:
authorGuangxiong Lin <[email protected]>2023-11-15 21:51:23 +0800
committerGuangxiong Lin <[email protected]>2023-11-15 21:51:23 +0800
commitdc7e5a5f94cc89c57c4ff7f20f90a55a1a0e6ec4 (patch)
tree2e3ea0867ff3f59eac82cda970037e85ed98736a /.config/fish/functions/bass.fish
parentd3090f37978866e38c63c6550771a4716094ac8e (diff)
downloaddotfiles-dc7e5a5f94cc89c57c4ff7f20f90a55a1a0e6ec4.tar.gz
dotfiles-dc7e5a5f94cc89c57c4ff7f20f90a55a1a0e6ec4.tar.bz2
dotfiles-dc7e5a5f94cc89c57c4ff7f20f90a55a1a0e6ec4.zip
Add bass into fish
Diffstat (limited to '.config/fish/functions/bass.fish')
-rw-r--r--.config/fish/functions/bass.fish29
1 files changed, 29 insertions, 0 deletions
diff --git a/.config/fish/functions/bass.fish b/.config/fish/functions/bass.fish
new file mode 100644
index 0000000..2b3af16
--- /dev/null
+++ b/.config/fish/functions/bass.fish
@@ -0,0 +1,29 @@
+function bass
+ set -l bash_args $argv
+ set -l bass_debug
+ if test "$bash_args[1]_" = '-d_'
+ set bass_debug true
+ set -e bash_args[1]
+ end
+
+ set -l script_file (mktemp)
+ if command -v python3 >/dev/null 2>&1
+ command python3 -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file
+ else
+ command python -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file
+ end
+ set -l bass_status $status
+ if test $bass_status -ne 0
+ return $bass_status
+ end
+
+ if test -n "$bass_debug"
+ cat $script_file
+ end
+ source $script_file
+ command rm $script_file
+end
+
+function __bass_usage
+ echo "Usage: bass [-d] <bash-command>"
+end