About
hp or HashParse is a fast, simple and completely dependency free command line argument parsing library. Parsing is done in O(n) where n is the number of supplied arguments and the implementation is based on HashMaps, all lookups should be in O(1) time complexity.
The most prominent features are:
- automatic help message generation.
- colorful and verbose error reporting.
- hierarchical commands and subcommands.
- easy to read and understand documentation.
Rationale
For the last few months all of my projects in Rust were command line tools. I'm still a student with a ton of time on my hands, so my approach generally was, and still is for the most part, to use as little dependencies as possible and try to implement most of the stuff I need myself so I can gain a better understanding of the component in question while also keeping the project's size and complexity at a minimum. When writing these command line tools, I realized that I needed a simple and efficient way to parse command line arguments. In every project I worked on I mostly used a variation of the same complex parser which was always a hassle to write and then scale and add more arguments to, as the project grew. I wanted something simple, small and fast with little to no dependencies, something that would provided everything that a simple CLI app might need. I knew of other libraries such as clap or structopt (both of which you should probably use instead of this), but I wanted to write something simple which would provide some of the same functionality, such as automatic --help message generation and a good way to report errors and most of all, a way to quickly add new commands and subcommands. So over the span of a few days, I wrote and documented most of hp the high performance, no dependency command line parsing library. There are still some things I want to change and improve, but it should be in a good and working condition now.
extern crate hp;
use ;
use exit;
Examples
Most of the functions have some simple code examples. There's also an examples directory which currently has a working calculator CLI app.
Contributing & Fixing
If you feel like there's something missing from hp feel free to open an issue or submit a pull request. All contributions and discussions are very welcome!