Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ohsayan/dab
Tool for Rustaceans in pursuit of laziness
https://github.com/ohsayan/dab
cli command-line-tool rust rust-lang
Last synced: 24 days ago
JSON representation
Tool for Rustaceans in pursuit of laziness
- Host: GitHub
- URL: https://github.com/ohsayan/dab
- Owner: ohsayan
- License: apache-2.0
- Created: 2022-06-06T06:38:34.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-06-06T11:41:12.000Z (over 2 years ago)
- Last Synced: 2024-10-09T17:30:48.167Z (about 1 month ago)
- Topics: cli, command-line-tool, rust, rust-lang
- Language: Rust
- Homepage:
- Size: 37.1 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# `dab`: The pursuit of laziness for Rustaceans
![Crates.io](https://img.shields.io/crates/v/dab?style=for-the-badge) ![Crates.io](https://img.shields.io/crates/l/dab?style=for-the-badge) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/ohsayan/dab/test?style=for-the-badge)
`dab` is a command-line tool that is intended for Rust developers to savor their much deserved laziness
after fighting with `async` lifetimes or FFI. Right now, it does one very simple thing: create modules.
Well, I got a little mad creating modules while I was [working on Skytable](https://github.com/skytable/skytable). Silly? [Read this](#background)!## Installation 🚀
Simply run:
```shell
$ cargo install dab
```## Usage
- Basic usage example: `dab modname`. This will create a `src/modname/mod.rs` file along with
a module declaration (like `mod modname`) in the "root file" which is either `lib.rs`
or `main.rs` depending on your crate type
- Advanced usage example: `dab -cskip --dskip --public mymod`: This will create a `src/mymod.rs`
file (note no directory creation), skip a license header in the "root file" (if any) and mark
the module visibility to be `pub`## Features ✨
- [x] Create modules in binary/library packages
- [x] Choose if module is public/private (private by default)
- [x] Ignore comments on top of file while adding modules ("license headers")
- [ ] Rewrite using `syn`
- [ ] Support full paths to deeply nested modules
- [ ] Enable parent creation if it doesn't exist
- [ ] Auto add file-header comments ("license headers" for example) to newly create modules
- [ ] Provide a `dab.toml` configuration that will be read for determining settings
- [ ] Run `rustfmt` on adding `mod` entry to the root file
- [ ] Support `cfg` attributes
- [ ] Support workspaces:
- [x] Support creating modules by package name (`skyd::protocol`)
- [ ] Detect workspace root and operate from any other directory (much like what `cargo` does)
- [ ] Support creation of packages in workspaces
- [ ] Open code editor to the newly created module
- Have ideas? [Create an issue!](https://github.com/skytable/dab/issues/new)## Background
Call it my personal itch, in large Rust projects I've been extremely annoyed while creating modules (especially in workspaces). The usual sequence was:
1. `mkdir /src/path/to/module`
2. `touch /src/path/to/module/mod.rs`
3. Edit `main.rs` or `lib.rs` to add the package the name
4. Open the code editor and add codeI wanted to trim this down to one step. Hence, this tool.
## License
This tool is licensed under the [Apache-2.0 License](./LICENSE).