5 Developer CLI Essentials
Tags: programming, cli, devtools, opensource
Published: 2024-01-02 18:00:00

Happy New Year everyone! I want to start this year right with an article showcasing some of the CLI tools that I couldn’t do without in 2023. With this article I’ll be adopting a new writing style, keeping things short and sweet while giving all you need to get started and productively use some of the things I will write about in 2024.

Without further a do, let’s jump into the tools that I just couldn’t do without.

## 1. [pkgx](https://pkgx.sh)

If you follow me on [X](https://twitter.com/devshogun), you’ve probably seen me mention this a couple of times. pkgx is the package manager to rule them all. No, I’m not exaggerating.

Pkgx allows you to run anything, anywhere and on almost any computer. Heck, one of our community members even got it to run on a powkiddy device.

You can run any command that pkgx has in its registry directly without having to explicitly install it on your machine. Here’s an example of what that looks like

<video controls="controls" width="100%" height="auto" name="pkgx-ollama-corrected-demo.mp4" src="https://yvellwnvywwynkrgnsvr.supabase.co/storage/v1/object/public/blog/5-developer-cli-essentials/pkgx-ollama-corrected-demo.mp4?t=2024-01-02T16%3A36%3A05.355Z"></video>

Once you have pkgx installed, by simply prefixing any command that you want to run with `pkgx`, it will search its registry for the command and install it if it finds it. Then it will run the command for you immediately after.

Pkgx also has a dev environment tool built in. Using the `dev` command pkgx creates a dev environment in that directory and automatically installs any packages and tools needed for said environment.

## 2. [git](https://git-scm.com/)

As a developer, you must have some sort of version control tool like git. Git is a version control system that allows you to track changes in your code and easily revert to previous versions if needed. It's an essential tool for managing and organizing your codebase and workflow, and it integrates seamlessly with popular code hosting platforms like GitHub and GitLab.

Git makes things like debugging and collaboration easier since it allows you to revert to previous versions of things using commit history and merge and compare code from collaborators.

I can’t count how many times I’ve either created a separate branch to messily debug an issue clean it up and merge it into the main branch or how many times I’ve rollback commits because I broke something in some way or another.

Here’s a quick example of how to commit, branch, and merge code using git.

<video controls="controls" width="100%" height="auto" name="git-demo.mp4" src="https://yvellwnvywwynkrgnsvr.supabase.co/storage/v1/object/public/blog/5-developer-cli-essentials/git%20demo.mp4?t=2024-01-02T16%3A44%3A39.833Z"></video>

## 3. [lazygit](https://github.com/jesseduffield/lazygit)

Lazygit is a terminal UI that helps you visualize your git commit history and changes. With Lazygit you’re able to better understand the changes you’ve made to your project without having to keep running `git status` and `git diff`. 

![Image of the lazygit terminal UI](https://yvellwnvywwynkrgnsvr.supabase.co/storage/v1/object/public/blog/5-developer-cli-essentials/Screenshot%202023-12-26%20at%2018.06.36.png?t=2024-01-02T16%3A46%3A40.518Z)

It’s an amazing tool for whenever you’ve made too many changes to a project or just have too many git operations going on. Now, I can’t say that I use it weekly but I can say that it has saved me some time and stress when working in large codebases and whenever I want to unscrew myself 😅.

## 4. [bat](https://github.com/sharkdp/bat)

You can think of bat as a cat clone except with syntax highlighting. Bat has things like syntax highlighting, git diffs and more. I often use bat to peek into files while I code or try to understand a codebase that I was just introduced to.

![Image of the bat CLI tool in action](https://yvellwnvywwynkrgnsvr.supabase.co/storage/v1/object/public/blog/5-developer-cli-essentials/Screenshot%202024-01-02%20at%2017.06.45.png?t=2024-01-02T16%3A47%3A41.322Z)

As you can see it offers syntax highlighting for the `package.yml` file being viewed. I highly recommend it over `cat` especially if you’re a dev.

## 5. [httpie](https://httpie.io/cli)

Httpie is an API test client in your terminal that offers JSON highlighting, header parsing, body parsing, session parsing, and more. It’s lightweight, open-source, and intuitive, everything that devs love. Here’s an example of it querying the Coingecko API 

![Image of the httpie CLI tool in action](https://yvellwnvywwynkrgnsvr.supabase.co/storage/v1/object/public/blog/5-developer-cli-essentials/Screenshot%202024-01-02%20at%2017.20.14.png?t=2024-01-02T16%3A48%3A28.992Z)

## Conclusion

In conclusion, these CLI tools have been instrumental in my productivity as a developer. From the convenience of pkgx, which allows me to run any command without explicitly installing it, to the power of git for version control and collaboration. Lazygit helps me visualize my git history, while bat provides syntax highlighting for file viewing. Lastly, httpie simplifies API testing in the terminal. I highly recommend incorporating these tools into your workflow to enhance your development experience.