Skip to content

Commit d68e0cb

Browse files
committed
release: 0.1.1
2 parents ed3de1b + a4461cc commit d68e0cb

File tree

7 files changed

+36
-28
lines changed

7 files changed

+36
-28
lines changed

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
`BashMan` is a Cargo plugin that helps you generate BASH completions and/or MAN pages for your Rust apps using metadata from your projects' `Cargo.toml` manifests. It pairs well with the (unaffiliated) [cargo-deb](https://github.com/mmstick/cargo-deb).
44

5+
(This can technically be used for non-Rust apps. It just parses the data out of a [TOML](https://en.wikipedia.org/wiki/TOML) file. Any TOML'll do.)
6+
57
BASH completions are sub-command aware — one level deep — and avoid making duplicate suggestions. For example, if the line already has `-h`, it will not suggest `-h` or its long variant `--help`.
68

79
MAN pages are automatically populated with the primary sections — `NAME`, `DESCRIPTION`, `USAGE`, `SUBCOMMANDS`, `FLAGS`, `OPTIONS`, `ARGUMENTS` — and the top level page can be extended with additional arbitrary sections as needed. If subcommands are defined, additional pages for each are generated, showing their particular usage, flags, etc.
@@ -52,8 +54,8 @@ For everything else, start by adding a section to your `Cargo.toml` manifest lik
5254
```toml
5355
[package.metadata.bashman]
5456
name = "Cargo BashMan"
55-
bash-dir = "../release/bash_completion.d"
56-
man-dir = "../release/man1"
57+
bash-dir = "../release/completions"
58+
man-dir = "../release/man"
5759
```
5860

5961
| Key | Type | Description | Default |
@@ -207,10 +209,17 @@ items = [
207209

208210
Taking `BashMan` as an example, the `Cargo.toml` will end up containing something like:
209211
```toml
212+
[package]
213+
name = "cargo-bashman"
214+
version = "0.1.0"
215+
description = "BashMan is a Cargo plugin that helps you generate BASH completions and/or MAN pages for your Rust project."
216+
217+
...
218+
210219
[package.metadata.bashman]
211220
name = "Cargo BashMan"
212-
bash-dir = "../release/bash_completion.d"
213-
man-dir = "../release/man1"
221+
bash-dir = "../release/completions"
222+
man-dir = "../release/man"
214223

215224
[[package.metadata.bashman.switches]]
216225
short = "-h"

bashman/Cargo.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cargo-bashman"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
license = "WTFPL"
55
authors = ["Josh Stoik <[email protected]>"]
66
edition = "2018"
@@ -16,33 +16,33 @@ depends = "$auto"
1616
section = "utility"
1717
assets = [
1818
["../target/x86_64-unknown-linux-gnu/release/cargo-bashman", "usr/bin/", "755"],
19-
["../release/bash_completion.d/cargo-bashman.bash", "etc/bash_completion.d/", "644"],
20-
["../release/man1/cargo-bashman.1.gz", "usr/share/man/man1/", "644"],
19+
["../release/completions/cargo-bashman.bash", "etc/bash_completion.d/", "644"],
20+
["../release/man/cargo-bashman.1.gz", "usr/share/man/man1/", "644"],
2121
]
2222

2323
[package.metadata.bashman]
2424
name = "Cargo BashMan"
25-
bash-dir = "../release/bash_completion.d"
26-
man-dir = "../release/man1"
25+
bash-dir = "../release/completions"
26+
man-dir = "../release/man"
2727

2828
[[package.metadata.bashman.switches]]
2929
short = "-h"
3030
long = "--help"
3131
description = "Print help information."
3232
subcommands = [ "", "sub" ]
3333

34+
[[package.metadata.bashman.switches]]
35+
short = "-V"
36+
long = "--version"
37+
description = "Print application version."
38+
3439
[[package.metadata.bashman.options]]
3540
short = "-m"
3641
long = "--manifest-path"
3742
description = "Path to the Cargo.toml file to use."
3843
label = "<Cargo.toml>"
3944
path = true
4045

41-
[[package.metadata.bashman.switches]]
42-
short = "-V"
43-
long = "--version"
44-
description = "Print application version."
45-
4646
[dependencies]
4747
chrono = "0.4.*"
4848
indexmap = "1.6.*"

bashman/help.txt

Lines changed: 0 additions & 9 deletions
This file was deleted.

bashman/src/main.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,19 @@ fn helper(_: Option<&str>) {
310310
\_/;-.,____,.-;\_/
311311
======(_(_(==)_)_)======
312312
313-
{}
313+
USAGE:
314+
cargo bashman [FLAGS] [OPTIONS]
315+
316+
FLAGS:
317+
-h, --help Prints help information.
318+
-V, --version Prints version information.
319+
320+
OPTIONS:
321+
-m, --manifest-path <FILE> Read file paths from this list.
322+
314323
",
315324
"\x1b[38;5;199mCargo BashMan\x1b[0;38;5;69m v",
316325
env!("CARGO_PKG_VERSION"),
317326
"\x1b[0m",
318-
include_str!("../help.txt")
319327
)).print();
320328
}

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ rustflags := "-C link-arg=-s"
4141

4242
# Build Debian package!
4343
@build-deb: build
44-
# Do completions.
44+
# Do completions/man.
4545
{{ cargo_bin }} -m "{{ pkg_dir1 }}/Cargo.toml"
4646

4747
# cargo-deb doesn't support target_dir flags yet.

release/man1/cargo-bashman.1 renamed to release/man/cargo-bashman.1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
.TH "CARGO BASHMAN" "1" "November 2020" "Cargo BashMan v0.1.0" "User Commands"
1+
.TH "CARGO BASHMAN" "1" "November 2020" "Cargo BashMan v0.1.1" "User Commands"
22
.SH NAME
3-
Cargo BashMan \- Manual page for cargo\-bashman v0.1.0.
3+
Cargo BashMan \- Manual page for cargo\-bashman v0.1.1.
44
.SH DESCRIPTION
55
BashMan is a Cargo plugin that helps you generate BASH completions and/or MAN pages for your Rust project.
66
.SS USAGE:

0 commit comments

Comments
 (0)