mirror of
https://github.com/rzmk/commit-helper.git
synced 2025-12-19 05:29:24 +00:00
feat: use clap crate, add -m flag, change -d to --debug
This commit is contained in:
parent
86ee66c7be
commit
07e03335cc
6 changed files with 374 additions and 113 deletions
61
README.md
61
README.md
|
|
@ -1,11 +1,9 @@
|
|||
# commit-helper (ch)
|
||||
|
||||
A simple tool to help write commit messages and run git commands.
|
||||
A simple tool to help run commands related to `git commit` in one go.
|
||||
|
||||

|
||||
|
||||
You may read a brief post about commit-helper on my website: [mueezkhan.com/memos/commit-helper](https://www.mueezkhan.com/memos/commit-helper)
|
||||
|
||||
## Installation
|
||||
|
||||
Make sure you have [Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html) installed, then run the following command in your terminal:
|
||||
|
|
@ -14,49 +12,82 @@ Make sure you have [Cargo](https://doc.rust-lang.org/cargo/getting-started/insta
|
|||
cargo install --git https://github.com/rzmk/commit-helper
|
||||
```
|
||||
|
||||
## Usage
|
||||
## Reference
|
||||
|
||||
To run the tool, simply run `ch` in your terminal:
|
||||
To run the interactive workflow, simply run `ch` in your terminal:
|
||||
|
||||
```bash
|
||||
ch
|
||||
```
|
||||
|
||||
### `-a`
|
||||
### `--help` or `-h`
|
||||
|
||||
If you want to run `git add -A` before committing, use the `-a` flag:
|
||||
To get the help message, run `ch --help` or `ch -h`:
|
||||
|
||||
```bash
|
||||
ch -h
|
||||
```
|
||||
|
||||
### `--add` or `-a`
|
||||
|
||||
If you want to run `git add -A` before committing, use the `--add` or `-a` flag:
|
||||
|
||||
```bash
|
||||
ch -a
|
||||
```
|
||||
|
||||
### `-p`
|
||||
### `--push` or `-p`
|
||||
|
||||
If you want to run `git push` after committing, use the `-p` flag:
|
||||
If you want to run `git push` after committing, use the `--push` or `-p` flag:
|
||||
|
||||
```bash
|
||||
ch -p
|
||||
```
|
||||
|
||||
### `--dry-run` or `-d`
|
||||
### `--message` or `-m`
|
||||
|
||||
If you want to do a dry run without actually adding or committing, use the `-d` or `--dry-run` flag:
|
||||
If you want to pass in a custom commit message (therefore skipping the interactive steps), use the `--message` or `-m` flag:
|
||||
|
||||
```bash
|
||||
ch -m "feat: add new feature"
|
||||
```
|
||||
|
||||
### `--debug` or `-d`
|
||||
|
||||
If you want to see the debug output, use the `--debug` or `-d` flag:
|
||||
|
||||
```bash
|
||||
ch -d
|
||||
```
|
||||
|
||||
> Note: The debug output will not be printed if you use the `--dry-run` flag.
|
||||
|
||||
### `--dry-run`
|
||||
|
||||
If you want to do a dry run without executing any commands, use the `--dry-run` flag:
|
||||
|
||||
```bash
|
||||
ch --dry-run
|
||||
```
|
||||
|
||||
### `--debug`
|
||||
## Example
|
||||
|
||||
If you want to see the debug output, use the `--debug` flag:
|
||||
If I want to run `git add -A`, then `git commit -m "feat: add new feature"`, then `git push` all in one go, I could run the following command:
|
||||
|
||||
```bash
|
||||
ch --debug
|
||||
ch -m "feat: add new feature" -a -p
|
||||
```
|
||||
|
||||
Note that the debug output will not be printed if you use the `--dry-run` flag.
|
||||
Equivalently to the above command, I may instead combine the short flags:
|
||||
|
||||
```bash
|
||||
ch -apm "feat: add new feature"
|
||||
```
|
||||
|
||||
> Note: The order of the combined short flags does not matter, except for the `-m` flag, which must be the last flag if you want to pass in a custom commit message after a combination of flags.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- [Rust](https://www.rust-lang.org/)
|
||||
- [clap](https://github.com/clap-rs/clap)
|
||||
- [inquire](https://github.com/mikaelmello/inquire)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue