Skip to content

Commit

Permalink
Merge pull request #544 from PaulYuuu/manpages-fix
Browse files Browse the repository at this point in the history
docs: Set bin_name and disable version option for subcommands
  • Loading branch information
cgwalters authored May 17, 2024
2 parents 7700626 + 7df0b58 commit 1f0c19a
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 125 deletions.
57 changes: 0 additions & 57 deletions docs/src/bootc.md

This file was deleted.

8 changes: 2 additions & 6 deletions docs/src/man/bootc-edit.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ bootc-edit - Apply full changes to the host specification

# SYNOPSIS

**bootc-edit** \[**-f**\|**\--filename**\] \[**\--quiet**\]
\[**-h**\|**\--help**\] \[**-V**\|**\--version**\]
**bootc edit** \[**-f**\|**\--filename**\] \[**\--quiet**\]
\[**-h**\|**\--help**\]

# DESCRIPTION

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

: Print help (see a summary with -h)

**-V**, **\--version**

: Print version

# VERSION

v0.1.11
7 changes: 1 addition & 6 deletions docs/src/man/bootc-install-print-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ processes using \`install to-filesystem\` that want to honor e.g.

# SYNOPSIS

**bootc-install-print-configuration** \[**-h**\|**\--help**\]
\[**-V**\|**\--version**\]
**bootc install print-configuration** \[**-h**\|**\--help**\]

# DESCRIPTION

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

: Print help (see a summary with -h)

**-V**, **\--version**

: Print version

# VERSION

v0.1.11
9 changes: 2 additions & 7 deletions docs/src/man/bootc-install-to-disk.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ bootc-install-to-disk - Install to the target block device

# SYNOPSIS

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

# DESCRIPTION

Expand Down Expand Up @@ -128,10 +127,6 @@ firmware will be skipped

: Print help (see a summary with -h)

**-V**, **\--version**

: Print version

\<*DEVICE*\>

: Target block device for installation. The entire device will be
Expand Down
8 changes: 2 additions & 6 deletions docs/src/man/bootc-install-to-existing-root.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ root filesystem

# SYNOPSIS

**bootc-install-to-existing-root** \[**\--replace**\]
**bootc install to-existing-root** \[**\--replace**\]
\[**\--source-imgref**\] \[**\--target-transport**\]
\[**\--target-imgref**\] \[**\--enforce-container-sigpolicy**\]
\[**\--target-ostree-remote**\] \[**\--skip-fetch-check**\]
\[**\--disable-selinux**\] \[**\--karg**\]
\[**\--root-ssh-authorized-keys**\] \[**\--generic-image**\]
\[**\--acknowledge-destructive**\] \[**-h**\|**\--help**\]
\[**-V**\|**\--version**\] \[*ROOT_PATH*\]
\[*ROOT_PATH*\]

# DESCRIPTION

Expand Down Expand Up @@ -117,10 +117,6 @@ firmware will be skipped

: Print help (see a summary with -h)

**-V**, **\--version**

: Print version

\[*ROOT_PATH*\] \[default: /target\]

: Path to the mounted root; its expected to invoke podman with \`-v
Expand Down
8 changes: 2 additions & 6 deletions docs/src/man/bootc-install-to-filesystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ bootc-install-to-filesystem - Install to the target filesystem

# SYNOPSIS

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

# DESCRIPTION

Expand Down Expand Up @@ -140,10 +140,6 @@ firmware will be skipped

: Print help (see a summary with -h)

**-V**, **\--version**

: Print version

\<*ROOT_PATH*\>

: Path to the mounted root filesystem.
Expand Down
7 changes: 1 addition & 6 deletions docs/src/man/bootc-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ bootc-install - Install the running container to a target

# SYNOPSIS

**bootc-install** \[**-h**\|**\--help**\] \[**-V**\|**\--version**\]
\<*subcommands*\>
**bootc install** \[**-h**\|**\--help**\] \<*subcommands*\>

# DESCRIPTION

Expand Down Expand Up @@ -35,10 +34,6 @@ includes other setup and metadata.

: Print help (see a summary with -h)

**-V**, **\--version**

: Print version

# SUBCOMMANDS

bootc-install-to-disk(8)
Expand Down
6 changes: 1 addition & 5 deletions docs/src/man/bootc-rollback.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ queued upgrade) then it will be discarded

# SYNOPSIS

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

# DESCRIPTION

Expand All @@ -32,10 +32,6 @@ rollback invocation.

: Print help (see a summary with -h)

**-V**, **\--version**

: Print version

# VERSION

v0.1.11
8 changes: 2 additions & 6 deletions docs/src/man/bootc-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ bootc-status - Display status

# SYNOPSIS

**bootc-status** \[**\--json**\] \[**\--booted**\]
\[**-h**\|**\--help**\] \[**-V**\|**\--version**\]
**bootc status** \[**\--json**\] \[**\--booted**\]
\[**-h**\|**\--help**\]

# DESCRIPTION

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

: Print help (see a summary with -h)

**-V**, **\--version**

: Print version

# VERSION

v0.1.11
9 changes: 2 additions & 7 deletions docs/src/man/bootc-switch.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ bootc-switch - Target a new container image reference to boot

# SYNOPSIS

**bootc-switch** \[**\--quiet**\] \[**\--transport**\]
**bootc switch** \[**\--quiet**\] \[**\--transport**\]
\[**\--enforce-container-sigpolicy**\] \[**\--ostree-remote**\]
\[**\--retain**\] \[**-h**\|**\--help**\] \[**-V**\|**\--version**\]
\<*TARGET*\>
\[**\--retain**\] \[**-h**\|**\--help**\] \<*TARGET*\>

# DESCRIPTION

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

: Print help (see a summary with -h)

**-V**, **\--version**

: Print version

\<*TARGET*\>

: Target image to use for the next boot
Expand Down
8 changes: 2 additions & 6 deletions docs/src/man/bootc-upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ bootc-upgrade - Download and queue an updated container image to apply

# SYNOPSIS

**bootc-upgrade** \[**\--quiet**\] \[**\--check**\] \[**\--apply**\]
\[**-h**\|**\--help**\] \[**-V**\|**\--version**\]
**bootc upgrade** \[**\--quiet**\] \[**\--check**\] \[**\--apply**\]
\[**-h**\|**\--help**\]

# DESCRIPTION

Expand Down Expand Up @@ -50,10 +50,6 @@ userspace-only restart.

: Print help (see a summary with -h)

**-V**, **\--version**

: Print version

# VERSION

v0.1.11
6 changes: 1 addition & 5 deletions docs/src/man/bootc-usr-overlay.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ will be discarded on reboot

# SYNOPSIS

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

# DESCRIPTION

Expand Down Expand Up @@ -37,10 +37,6 @@ unmount\".

: Print help (see a summary with -h)

**-V**, **\--version**

: Print version

# VERSION

v0.1.11
12 changes: 10 additions & 2 deletions lib/src/docgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ pub fn generate_manpages(directory: &Utf8Path) -> Result<()> {
fn generate_one(directory: &Utf8Path, cmd: Command) -> Result<()> {
let version = env!("CARGO_PKG_VERSION");
let name = cmd.get_name();
let bin_name = cmd.get_bin_name()
.unwrap_or_else(|| name);
let path = directory.join(format!("{name}.8"));
println!("Generating {path}...");

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

for subcmd in cmd.get_subcommands().filter(|c| !c.is_hide_set()) {
let subname = format!("{}-{}", name, subcmd.get_name());
let bin_name = format!("{} {}", bin_name, subcmd.get_name());
// SAFETY: Latest clap 4 requires names are &'static - this is
// not long-running production code, so we just leak the names here.
let subname = &*std::boxed::Box::leak(subname.into_boxed_str());
let subcmd = subcmd.clone().name(subname).alias(subname).version(version);
let bin_name = &*std::boxed::Box::leak(bin_name.into_boxed_str());
let subcmd = subcmd.clone()
.name(subname)
.alias(subname)
.bin_name(bin_name)
.version(version)
.disable_version_flag(true);
generate_one(directory, subcmd.clone().name(subname).version(version))?;
}
Ok(())
Expand Down

0 comments on commit 1f0c19a

Please sign in to comment.