Vidar Hokstad [email protected], 2023. Licensed under the MIT license.
With no options dir-commands looks for Makefile, Rakefile, Gemfile, package.json, .git etc. in the directory indicated by an argument or the current directory, and uses that to generate a list of names and commands, like this:
git gui|git gui
git push|git push
git status|git status
make clean|make clean
terminal|x-terminal-emulator
yarn build-css|yarn build-css
yarn build-js|yarn build-js
yarn build|yarn build
If you pass -n
or --names
, only the names (the part before '|') will be output. This makes the output suitable as input
to dmenu
or compatible scripts that expect a list of options on stdin.
If you pass -mSCRIPT
or --menu=SCRIPT
where SCRIPT can be e.g. dmenu
or 'rofi -dmenu
or similar compatible script,
dir-commands will execute that menu script and feed its output to the menu selectors input. A future version will likely
default to my own menu script if available, but that's not ready.
If you pass -r
or --run
, then dir-commands will either expect a command name on stdin or expect to read a command out
from a --menu
, which it will then match to one of the commands and execute.
-x
is shortcut for --names --run --menu (rofi -dmenu || dmenu if rofi is not found)
-t
or --term
allows you to force dir-commands to open a new terminal even if executed from a tty (without -t,
dir-commands will execute a terminal only if executed without a tty, and otherwise run the commands in the current terminal).
The terminal is chosen from the first found in the path of x-terminal-emulator
(usually a symlink in
/etc/alternatives/x-terminal-emulator), term
, st
, mlterm
, rxvt
, xterm
)