Skip to content

Commit 5040a4c

Browse files
committed
Fix with fork of clap-markdown
1 parent 46aabc1 commit 5040a4c

File tree

4 files changed

+10
-15
lines changed

4 files changed

+10
-15
lines changed

Cargo.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

HELP.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ Manages butane database migrations.
5050

5151
###### **Options:**
5252

53+
* `-v`, `--verbose` — Increase logging verbosity
54+
* `-q`, `--quiet` — Decrease logging verbosity
5355
* `-p`, `--path <PATH>`
5456

5557
Default value: `<detected project containing .butane directory>`
56-
* `-v`, `--verbose` — Increase logging verbosity
57-
* `-q`, `--quiet` — Decrease logging verbosity
5858

5959

6060

butane_cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ butane.workspace = true
3131
cargo_metadata = "0.23"
3232
chrono = { workspace = true }
3333
clap = { version = "4.1", features = ["derive", "string", "wrap_help"] }
34-
clap-markdown = { version = "0.1.5", optional = true }
34+
clap-markdown = { git = "https://github.com/jayvdb/clap-markdown", branch = "allow-passing-instance", optional = true }
3535
clap-verbosity-flag = "3.0"
3636
env_logger.workspace = true
3737
log.workspace = true

butane_cli/src/main.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,16 @@ use butane_cli::{
88
detach_latest_migration, embed, get_migrations, handle_error, init, list_backends,
99
list_migrations, make_migration, migrate, regenerate_migrations, remove_backend, unmigrate,
1010
};
11-
use clap::{ArgAction, Parser, Subcommand};
11+
use clap::{ArgAction, CommandFactory, Parser, Subcommand};
1212

1313
#[derive(Parser)]
1414
#[command(author, version, about = "Manages butane database migrations.")]
1515
#[command(propagate_version = true, max_term_width = 80)]
1616
struct Cli {
1717
#[command(subcommand)]
1818
command: Commands,
19-
#[cfg(not(feature = "clap-markdown"))]
2019
#[arg(short = 'p', long, default_value=butane_cli::base_dir().into_os_string())]
2120
path: PathBuf,
22-
#[cfg(feature = "clap-markdown")]
23-
#[arg(
24-
short = 'p',
25-
long,
26-
default_value = "<detected project containing .butane directory>"
27-
)]
28-
path: PathBuf,
2921
#[command(flatten)]
3022
verbose: clap_verbosity_flag::Verbosity,
3123
#[cfg(feature = "clap-markdown")]
@@ -150,7 +142,12 @@ fn main() {
150142

151143
#[cfg(feature = "clap-markdown")]
152144
if cli.markdown_help {
153-
clap_markdown::print_help_markdown::<Cli>();
145+
let command = Cli::command();
146+
147+
let command = command.mut_arg("path", |arg| {
148+
arg.default_value("<detected project containing .butane directory>")
149+
});
150+
clap_markdown::print_help_markdown_command(&command);
154151
std::process::exit(0);
155152
}
156153

0 commit comments

Comments
 (0)