bass.fish 702 B

123456789101112131415161718192021222324252627
  1. function bass
  2. set __bash_args $argv
  3. if test "$__bash_args[1]_" = '-d_'
  4. set __bass_debug
  5. set -e __bash_args[1]
  6. end
  7. python (dirname (status -f))/__bass.py $__bash_args | read -z __script
  8. set __errorflag (string sub -s 1 -l 7 "$__script")
  9. if test "$__script" = '__usage'
  10. echo "Usage: bass [-d] <bash-command>"
  11. else if test "x$__errorflag" = 'x__error'
  12. echo "Bass encountered an error!"
  13. set __exitcode (string sub -s 9 "$__script")
  14. set __exitcode (string trim $__exitcode)
  15. if test -z $__exitcode
  16. return 1
  17. else
  18. return $__exitcode
  19. end
  20. else
  21. echo -e "$__script" | source -
  22. if set -q __bass_debug
  23. echo "$__script"
  24. end
  25. end
  26. end