Skip to content

Commit 1f0c19a

Browse files
authored
Merge pull request #544 from PaulYuuu/manpages-fix
docs: Set bin_name and disable version option for subcommands
2 parents 7700626 + 7df0b58 commit 1f0c19a

13 files changed

+28
-125
lines changed

docs/src/bootc.md

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

docs/src/man/bootc-edit.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ bootc-edit - Apply full changes to the host specification
44

55
# SYNOPSIS
66

7-
**bootc-edit** \[**-f**\|**\--filename**\] \[**\--quiet**\]
8-
\[**-h**\|**\--help**\] \[**-V**\|**\--version**\]
7+
**bootc edit** \[**-f**\|**\--filename**\] \[**\--quiet**\]
8+
\[**-h**\|**\--help**\]
99

1010
# DESCRIPTION
1111

@@ -34,10 +34,6 @@ Only changes to the \`spec\` section are honored.
3434

3535
: Print help (see a summary with -h)
3636

37-
**-V**, **\--version**
38-
39-
: Print version
40-
4137
# VERSION
4238

4339
v0.1.11

docs/src/man/bootc-install-print-configuration.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ processes using \`install to-filesystem\` that want to honor e.g.
77

88
# SYNOPSIS
99

10-
**bootc-install-print-configuration** \[**-h**\|**\--help**\]
11-
\[**-V**\|**\--version**\]
10+
**bootc install print-configuration** \[**-h**\|**\--help**\]
1211

1312
# DESCRIPTION
1413

@@ -25,10 +24,6 @@ string-valued filesystem name suitable for passing to \`mkfs.\$type\`.
2524

2625
: Print help (see a summary with -h)
2726

28-
**-V**, **\--version**
29-
30-
: Print version
31-
3227
# VERSION
3328

3429
v0.1.11

docs/src/man/bootc-install-to-disk.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ bootc-install-to-disk - Install to the target block device
44

55
# SYNOPSIS
66

7-
**bootc-install-to-disk** \[**\--wipe**\] \[**\--block-setup**\]
7+
**bootc install to-disk** \[**\--wipe**\] \[**\--block-setup**\]
88
\[**\--filesystem**\] \[**\--root-size**\] \[**\--source-imgref**\]
99
\[**\--target-transport**\] \[**\--target-imgref**\]
1010
\[**\--enforce-container-sigpolicy**\] \[**\--target-ostree-remote**\]
1111
\[**\--skip-fetch-check**\] \[**\--disable-selinux**\] \[**\--karg**\]
1212
\[**\--root-ssh-authorized-keys**\] \[**\--generic-image**\]
13-
\[**\--via-loopback**\] \[**-h**\|**\--help**\]
14-
\[**-V**\|**\--version**\] \<*DEVICE*\>
13+
\[**\--via-loopback**\] \[**-h**\|**\--help**\] \<*DEVICE*\>
1514

1615
# DESCRIPTION
1716

@@ -128,10 +127,6 @@ firmware will be skipped
128127

129128
: Print help (see a summary with -h)
130129

131-
**-V**, **\--version**
132-
133-
: Print version
134-
135130
\<*DEVICE*\>
136131

137132
: Target block device for installation. The entire device will be

docs/src/man/bootc-install-to-existing-root.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ root filesystem
55

66
# SYNOPSIS
77

8-
**bootc-install-to-existing-root** \[**\--replace**\]
8+
**bootc install to-existing-root** \[**\--replace**\]
99
\[**\--source-imgref**\] \[**\--target-transport**\]
1010
\[**\--target-imgref**\] \[**\--enforce-container-sigpolicy**\]
1111
\[**\--target-ostree-remote**\] \[**\--skip-fetch-check**\]
1212
\[**\--disable-selinux**\] \[**\--karg**\]
1313
\[**\--root-ssh-authorized-keys**\] \[**\--generic-image**\]
1414
\[**\--acknowledge-destructive**\] \[**-h**\|**\--help**\]
15-
\[**-V**\|**\--version**\] \[*ROOT_PATH*\]
15+
\[*ROOT_PATH*\]
1616

1717
# DESCRIPTION
1818

@@ -117,10 +117,6 @@ firmware will be skipped
117117

118118
: Print help (see a summary with -h)
119119

120-
**-V**, **\--version**
121-
122-
: Print version
123-
124120
\[*ROOT_PATH*\] \[default: /target\]
125121

126122
: Path to the mounted root; its expected to invoke podman with \`-v

docs/src/man/bootc-install-to-filesystem.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ bootc-install-to-filesystem - Install to the target filesystem
44

55
# SYNOPSIS
66

7-
**bootc-install-to-filesystem** \[**\--root-mount-spec**\]
7+
**bootc install to-filesystem** \[**\--root-mount-spec**\]
88
\[**\--boot-mount-spec**\] \[**\--replace**\]
99
\[**\--acknowledge-destructive**\] \[**\--skip-finalize**\]
1010
\[**\--source-imgref**\] \[**\--target-transport**\]
1111
\[**\--target-imgref**\] \[**\--enforce-container-sigpolicy**\]
1212
\[**\--target-ostree-remote**\] \[**\--skip-fetch-check**\]
1313
\[**\--disable-selinux**\] \[**\--karg**\]
1414
\[**\--root-ssh-authorized-keys**\] \[**\--generic-image**\]
15-
\[**-h**\|**\--help**\] \[**-V**\|**\--version**\] \<*ROOT_PATH*\>
15+
\[**-h**\|**\--help**\] \<*ROOT_PATH*\>
1616

1717
# DESCRIPTION
1818

@@ -140,10 +140,6 @@ firmware will be skipped
140140

141141
: Print help (see a summary with -h)
142142

143-
**-V**, **\--version**
144-
145-
: Print version
146-
147143
\<*ROOT_PATH*\>
148144

149145
: Path to the mounted root filesystem.

docs/src/man/bootc-install.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ bootc-install - Install the running container to a target
44

55
# SYNOPSIS
66

7-
**bootc-install** \[**-h**\|**\--help**\] \[**-V**\|**\--version**\]
8-
\<*subcommands*\>
7+
**bootc install** \[**-h**\|**\--help**\] \<*subcommands*\>
98

109
# DESCRIPTION
1110

@@ -35,10 +34,6 @@ includes other setup and metadata.
3534

3635
: Print help (see a summary with -h)
3736

38-
**-V**, **\--version**
39-
40-
: Print version
41-
4237
# SUBCOMMANDS
4338

4439
bootc-install-to-disk(8)

docs/src/man/bootc-rollback.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ queued upgrade) then it will be discarded
77

88
# SYNOPSIS
99

10-
**bootc-rollback** \[**-h**\|**\--help**\] \[**-V**\|**\--version**\]
10+
**bootc rollback** \[**-h**\|**\--help**\]
1111

1212
# DESCRIPTION
1313

@@ -32,10 +32,6 @@ rollback invocation.
3232

3333
: Print help (see a summary with -h)
3434

35-
**-V**, **\--version**
36-
37-
: Print version
38-
3935
# VERSION
4036

4137
v0.1.11

docs/src/man/bootc-status.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ bootc-status - Display status
44

55
# SYNOPSIS
66

7-
**bootc-status** \[**\--json**\] \[**\--booted**\]
8-
\[**-h**\|**\--help**\] \[**-V**\|**\--version**\]
7+
**bootc status** \[**\--json**\] \[**\--booted**\]
8+
\[**-h**\|**\--help**\]
99

1010
# DESCRIPTION
1111

@@ -31,10 +31,6 @@ The exact API format is not currently declared stable.
3131

3232
: Print help (see a summary with -h)
3333

34-
**-V**, **\--version**
35-
36-
: Print version
37-
3834
# VERSION
3935

4036
v0.1.11

docs/src/man/bootc-switch.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ bootc-switch - Target a new container image reference to boot
44

55
# SYNOPSIS
66

7-
**bootc-switch** \[**\--quiet**\] \[**\--transport**\]
7+
**bootc switch** \[**\--quiet**\] \[**\--transport**\]
88
\[**\--enforce-container-sigpolicy**\] \[**\--ostree-remote**\]
9-
\[**\--retain**\] \[**-h**\|**\--help**\] \[**-V**\|**\--version**\]
10-
\<*TARGET*\>
9+
\[**\--retain**\] \[**-h**\|**\--help**\] \<*TARGET*\>
1110

1211
# DESCRIPTION
1312

@@ -55,10 +54,6 @@ includes a default policy which requires signatures.
5554

5655
: Print help (see a summary with -h)
5756

58-
**-V**, **\--version**
59-
60-
: Print version
61-
6257
\<*TARGET*\>
6358

6459
: Target image to use for the next boot

docs/src/man/bootc-upgrade.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ bootc-upgrade - Download and queue an updated container image to apply
44

55
# SYNOPSIS
66

7-
**bootc-upgrade** \[**\--quiet**\] \[**\--check**\] \[**\--apply**\]
8-
\[**-h**\|**\--help**\] \[**-V**\|**\--version**\]
7+
**bootc upgrade** \[**\--quiet**\] \[**\--check**\] \[**\--apply**\]
8+
\[**-h**\|**\--help**\]
99

1010
# DESCRIPTION
1111

@@ -50,10 +50,6 @@ userspace-only restart.
5050

5151
: Print help (see a summary with -h)
5252

53-
**-V**, **\--version**
54-
55-
: Print version
56-
5753
# VERSION
5854

5955
v0.1.11

docs/src/man/bootc-usr-overlay.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ will be discarded on reboot
55

66
# SYNOPSIS
77

8-
**bootc-usr-overlay** \[**-h**\|**\--help**\] \[**-V**\|**\--version**\]
8+
**bootc usr-overlay** \[**-h**\|**\--help**\]
99

1010
# DESCRIPTION
1111

@@ -37,10 +37,6 @@ unmount\".
3737

3838
: Print help (see a summary with -h)
3939

40-
**-V**, **\--version**
41-
42-
: Print version
43-
4440
# VERSION
4541

4642
v0.1.11

lib/src/docgen.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ pub fn generate_manpages(directory: &Utf8Path) -> Result<()> {
1515
fn generate_one(directory: &Utf8Path, cmd: Command) -> Result<()> {
1616
let version = env!("CARGO_PKG_VERSION");
1717
let name = cmd.get_name();
18+
let bin_name = cmd.get_bin_name()
19+
.unwrap_or_else(|| name);
1820
let path = directory.join(format!("{name}.8"));
1921
println!("Generating {path}...");
2022

@@ -26,7 +28,6 @@ fn generate_one(directory: &Utf8Path, cmd: Command) -> Result<()> {
2628
.with_context(|| format!("opening {path}"))
2729
.map(std::io::BufWriter::new)?;
2830
clap_mangen::Man::new(cmd.clone())
29-
.title("bootc")
3031
.section("8")
3132
.source(format!("bootc {version}"))
3233
.render(&mut out)
@@ -36,10 +37,17 @@ fn generate_one(directory: &Utf8Path, cmd: Command) -> Result<()> {
3637

3738
for subcmd in cmd.get_subcommands().filter(|c| !c.is_hide_set()) {
3839
let subname = format!("{}-{}", name, subcmd.get_name());
40+
let bin_name = format!("{} {}", bin_name, subcmd.get_name());
3941
// SAFETY: Latest clap 4 requires names are &'static - this is
4042
// not long-running production code, so we just leak the names here.
4143
let subname = &*std::boxed::Box::leak(subname.into_boxed_str());
42-
let subcmd = subcmd.clone().name(subname).alias(subname).version(version);
44+
let bin_name = &*std::boxed::Box::leak(bin_name.into_boxed_str());
45+
let subcmd = subcmd.clone()
46+
.name(subname)
47+
.alias(subname)
48+
.bin_name(bin_name)
49+
.version(version)
50+
.disable_version_flag(true);
4351
generate_one(directory, subcmd.clone().name(subname).version(version))?;
4452
}
4553
Ok(())

0 commit comments

Comments
 (0)