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.

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay