#compdef bb _bb_classpath() { compset -P '*:' compset -S ':*' _alternative \ "classpath:$state:_path_files -qS: -g '*.(jar|zip)(-.)'" \ "classpath:$state:_path_files -r': ' -/" } _bb_tasks() { local -a tasks custom_tasks tasks=( 'clojure:invoke clojure' 'describe:print an EDN map with information about this version' 'doc:print docstring of var or namespace' 'help:print help' 'nrepl-server:start nrepl server' 'repl:start repl' 'run:run task' 'socket-repl:start a socket repl' 'tasks:print list of available tasks' 'uberjar:collect all required namespaces into a single jar' 'uberscript:collect all required namespaces into a single file' 'version:print version' ) tasks+=(${(f)"$(bb tasks | tail -n +3 | sed 's/:/\\:/g; s/ */:/')"}) _describe -V task tasks } _arguments -s -S -A "-*" : \ '(-cp -classpath)'{-cp,-classpath}'[specify where to find user class files]:class path:_bb_classpath' \ '--debug[print debug information and internal stacktrace in case of exception]' \ '--force[pass -Sforce to deps.clj, forcing recalculation of the classpath]' \ '--init[load file after any preloads and prior to evaluation/subcommands]:file:_files' \ '--config[load file instead of bb.edn]:file:_files' \ '--deps-root[treat dir as root of relative paths in config]:dir:_files -/' \ {--eval,-e}'[evaluate an expression]:expression' \ {--file,-f}'[evaluate a file]:file:_files' \ {--main,-m}'[call the -main function]:namespace' \ '-i[bind *input* to a lazy seq of lines from stdin]' \ '-I[bind *input* to a lazy seq of EDN values from stdin]' \ '-o[write lines to stdout]' \ '-O[write EDN values to stdout]' \ '--stream[stream over lines or EDN values from stdin]' \ {--help,-h}'[print help]' \ ':task:_bb_tasks' \ '*:arguments:_default'