Crates.io | codemonument_bx |
lib.rs | codemonument_bx |
version | 0.3.4 |
source | src |
created_at | 2024-10-25 11:56:56.147499 |
updated_at | 2024-10-25 11:56:56.147499 |
description | Simple, cross-platform, and fast command aliases with superpowers. |
homepage | |
repository | https://github.com/codemonument/bx |
max_upload_size | |
id | 1422442 |
size | 177,944 |
I forked this for my own usage. Also, since I'm currently starting to dabble in the rust world, I want to contribute back to the original project if I manage some meaningful improvements!
Simple, cross-platform, and fast command aliases with superpowers.
Documentation • Releases • Contributing
Bonnie is a command aliasing tool that allows you to quickly and efficiently define short aliases for long commands that you have to repeatedly run. Here's a quick feature overview:
Basically, if you have commands that you routinely run in a project, Bonnie is for you. Bonnie has support for both extremely simple and extremely complex use cases, all while maintaining top-notch performance.
The simplest possible Bonnie configuration file would look like this:
version = "0.3.2"
[scripts]
build = "echo Building"
This syntax easily expands as your scripts grow in complexity to support everything up to infinitely nestable subcommands that automatically execute in a certain order based on their exit codes, running in multiple stages using custom shells and different commands on different operating systems, all while interpolating given arguments and a few environment variables. No, that's not an exaggeration, you can see an example in the documentation!
Bash aliases are a great way of turning long commands into short commands, but they can't be easily customized on a per-folder basis. Bonnie can be. Further, if you want to interpolate custom arguments or environment variables, you'll have to write a small script for each alias. If you want subcommands, good luck! Bonnie solves all these problems with simple, intuitive syntax that just works.
Bonnie is also cross-platform, even supporting running different commands on different operating systems for the same command alias.
Make
?GNU Make was designed to recompile parts of a project when certain files change, however its capacity to specify command aliases has drawn many to use it for that purpose. However, Make is old and has a clunky, inflexible syntax. For even simple purposes, it can be hugely overkill.
By contrast, Bonnie uses TOML, which is designed specifically to be highly readable by humans, as well as a simple syntax that expands as you need it to. You don't have to write out configuration for things you'll never use.
If you have cargo
(Rust's package manager), you can install Bonnie easily by running cargo install bonnie
.
Otheriwse, you can install from the releases page for Windows, MacOS, Linux, and musl. If you need Bonnie for another system, you can clone this repository and build the project using Cargo as needed. If you think we should support a particular OS in the default releases, please open an issue and let us know!
After you've downloaded or built the binary, move it to a location where it's easily executable (e.g. /usr/local/bin
on Linux). You'll also need to make it executable (chmod +x ./[BINARY_NAME]
on Linux). Then, you should be able to run Bonnie from the terminal with bonnie
!
Bonnie provides pre-built executables for Linux and musl (e.g. Alpine Linux), which can be easily installed in a Dockerfile with this command:
RUN curl -L https://github.com/arctic-hen7/bonnie/releases/download/[VERSION]/bonnie-[OS]-amd64
Just replace [VERSION]
with the latest version (see the releases page) and [OS]
with the operating system you want the binary for (one of: windows
, macos
, linux
, or musl
).
No particular reason, the name just sounds nice. No offense intended whatsoever to those named Bonnie!
Bonnie is very fully-featured already, though the project is still under active development, and there are a few key features still to be added before v1.0.0. Also, Bonnie's ordered subcommands system (see the documentation) is very novel, and we need to see how it performs over a longer period of time in production.
Bonnie was originally intended to move to stable in May 2021, though a full rewrite of the program and the introduction of nearly every major feature the program now has occurred in June, delaying that deadline. Right now, Bonnie is scheduled to go to stable by the end of September 2021, but the program is used daily and is actively maintained, so don't let that discourage you!
~/.bonnie/template.toml
%[stdin]
?)You can see all the recent updates to the project in the changelog.
If there's anything you think should be on here, or if you find a bug, please open an issue and let us know!
Thanks so much! You can learn about how to contribute to Bonnie by reading the contributing guide, and please remember to stick to the code of conduct.
See LICENSE.