August 24th, 2024

Create an internal CLI using Just

The article outlines the development of an internal command-line interface for Acme Corporation to boost productivity, emphasizing the use of the "just" tool for cross-platform command management and documentation.

Read original articleLink Icon
Create an internal CLI using Just

The article discusses the creation of an internal command-line interface (CLI) for a hypothetical company, Acme Corporation, aimed at enhancing productivity and preserving institutional knowledge among developers. It emphasizes the importance of having a common entry point for commands, ease of contribution, cross-platform compatibility, and discoverability of commands. The author suggests using the tool "just," which is designed for running commands and is cross-platform, as the foundation for this CLI. The setup process involves creating a folder, adding a justfile, and defining various recipes (commands) that can be executed. The article provides examples of simple and platform-specific recipes, such as retrieving AWS IAM identities and listing systemd services. It also highlights the ability to embed scripts within recipes and the importance of documentation for user adoption. The final sections encourage sharing recipes via GitHub and suggest further enhancements like using nushell for cross-platform scripting and implementing command completions.

- Internal CLIs can help preserve knowledge and streamline workflows in development teams.

- The "just" tool is recommended for creating a cross-platform internal CLI.

- Recipes can be defined for various commands, including platform-specific and embedded scripts.

- Documentation and user adoption are critical for the success of internal tools.

- Sharing and updating recipes can be efficiently managed through GitHub.

Link Icon 3 comments
By @d0mine - 8 months
To discourage bash outside shell one-liners (where it is appropriate), fabric/invoke could be used. Bash/ssh commands are glued together using Python:

https://docs.fabfile.org/en/latest/getting-started.html#adde...

If you are Python dev, you could specify Python dependencies for script using pep 723 https://iscinumpy.dev/post/pep723/ (nix might be an overkill).

For notebooks, workflows, personal playbooks, notes Org Babel could be used (emacs) Here's example code blocks in Haskell (but many other languages can be used such as shell, jupyter, plantuml) https://youtu.be/1qOFYluebBg?si=muGfsaC1kI7Cgpyw

One of my favorite features are subtree specific settings that enable remote shell commands by configuring :dir to /ssh:host:

By @ivanjermakov - 8 months
What is the benefit of using shiny new `just` instead of an industry-standard `make`?
By @nunez - 8 months
> What about org-wide things, like installing useful tools, generating boilerplate code, or running complex AWS commands that no one remembers?

You can do all of this with make and make includes.