DEV Community

Niklas Schlimm
Niklas Schlimm

Posted on

Automate your command line with EasyKey.shellmenu

As a developer, I work with many different tools on the command line. That's why I got into the habit of recording everything in a simple shell menu. That's how I came up with EasyKey.shellmenu. This allows me to easily create shell menus for my tools. I use it for kubectl, Maven and Git. Here is an example:

source "/path/to/shellmenu.sh"
menuInit "Maven demo menu"
submenuHead "Life cycle commands:"
menuItem c "Clean all" "mvn clean:clean"
menuItem x "Compile" "mvn clean compile"
menuItem t "Test" "mvn clean test"
menuItem i "Install" "mvn clean install"
submenuHead "Also usefull:"
menuItem d "Analyze dependencies" "mvn dependency:analyze"
menuItem u "Clean compile force updates" "mvn clean compile -U -DskipTests"
menuItem e "Show effective settings" "mvn help:effective-settings"
menuItem r "Show local repo location" "mvn help:evaluate -Dexpression=settings.localRepository | grep -v '\[INFO\]'"
menuItem l "Show global settings file location" showGlobalSettingFile
startMenu

The snippet creates a simple Maven menu like this:

Image description

In the repository on Github for EasyKey.shellmenu there are two more complex examples of menus for Git and kubectl. Check it out an if you like it please leave me a star for sharing it.

Top comments (0)