https://github.com/pauliyobo/cmd-rs
Build interactive commandline apps with rust
https://github.com/pauliyobo/cmd-rs
cli command-line rust shell
Last synced: 3 months ago
JSON representation
Build interactive commandline apps with rust
- Host: GitHub
- URL: https://github.com/pauliyobo/cmd-rs
- Owner: pauliyobo
- License: mit
- Created: 2021-09-28T10:04:18.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-01-13T05:44:43.000Z (over 4 years ago)
- Last Synced: 2025-07-14T07:53:43.331Z (12 months ago)
- Topics: cli, command-line, rust, shell
- Language: Rust
- Homepage:
- Size: 26.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cmd-rs
Cmd-rs is an attempt to build a library which helps to build interactive commandline apps with ease.
It was inspired by the cmd module in python and the excellent [cmd2](https://github.com/python-cmd2/cmd2) library.
## Usage
To use this library you can set the dependency which points to this git repository, since it has not been published on crates.io yet.
```toml
[dependencies]
cmd-rs = { git = "https://github.com/pauliyobo/cmd-rs"}
```
A simple example which just prints the text test when invoked is the following:
```rust
use cmd_rs::{inventory, make_command, CommandProcessor, Result};
#[make_command]
fn test() -> Result<()> {
println!("test");
Ok(())
}
fn main() {
CommandProcessor::new()
.with_prompt(">")
.run();
}
```
There is also another example in the examples directory.
## Roadmap
I started building cmd-rs also to gain more experience with the rust programming language, so The API will most likely break a lot. Sorry for the inconvenience. However those are some of the steps I'd like to get done at some point, in no particular order.
* [ ] Adding validation when calling commands. E.G. the library should error if a command contains whitespace.
* [ ] Adding more documentation
* [ ] Even if this probably at a later stage. Adding a CI pipeline. perhaps github actions?
* [ ] add pre-commit hook to lint and format code instead of having to do that manually
* [ ] Adding tests where possible
* [ ] publishing on crates.io
## Contributing
If you find this project useful and would like to improve it, feel free to open an issue or send a pull request