@@ -39,10 +39,9 @@ use crate::utils::sigpolicy_from_opt;
3939/// Shared progress options
4040#[ derive( Debug , Parser , PartialEq , Eq ) ]
4141pub ( crate ) struct ProgressOptions {
42- /// File descriptor number which must refer to an open pipe (anonymous or named) .
42+ /// File descriptor number which must refer to an open pipe.
4343 ///
44- /// Interactive progress will be written to this file descriptor as "JSON lines"
45- /// format, where each value is separated by a newline.
44+ /// Progress is written as JSON lines to this file descriptor.
4645 #[ clap( long, hide = true ) ]
4746 pub ( crate ) progress_fd : Option < RawProgressFd > ,
4847}
@@ -69,23 +68,19 @@ pub(crate) struct UpgradeOpts {
6968
7069 /// Check if an update is available without applying it.
7170 ///
72- /// This only downloads an updated manifest and image configuration (i.e. typically kilobyte-sized metadata)
73- /// as opposed to the image layers.
71+ /// This only downloads updated metadata, not the full image layers.
7472 #[ clap( long, conflicts_with = "apply" ) ]
7573 pub ( crate ) check : bool ,
7674
7775 /// Restart or reboot into the new target image.
7876 ///
79- /// Currently, this option always reboots. In the future this command
80- /// will detect the case where no kernel changes are queued, and perform
81- /// a userspace-only restart.
77+ /// Currently, this always reboots. Future versions may support userspace-only restart.
8278 #[ clap( long, conflicts_with = "check" ) ]
8379 pub ( crate ) apply : bool ,
8480
8581 /// Configure soft reboot behavior.
8682 ///
87- /// 'required' will fail if soft reboot is not available.
88- /// 'auto' will use soft reboot if available, otherwise fall back to regular reboot.
83+ /// 'required' fails if soft reboot unavailable, 'auto' falls back to regular reboot.
8984 #[ clap( long = "soft-reboot" , conflicts_with = "check" ) ]
9085 pub ( crate ) soft_reboot : Option < SoftRebootMode > ,
9186
@@ -102,16 +97,13 @@ pub(crate) struct SwitchOpts {
10297
10398 /// Restart or reboot into the new target image.
10499 ///
105- /// Currently, this option always reboots. In the future this command
106- /// will detect the case where no kernel changes are queued, and perform
107- /// a userspace-only restart.
100+ /// Currently, this always reboots. Future versions may support userspace-only restart.
108101 #[ clap( long) ]
109102 pub ( crate ) apply : bool ,
110103
111104 /// Configure soft reboot behavior.
112105 ///
113- /// 'required' will fail if soft reboot is not available.
114- /// 'auto' will use soft reboot if available, otherwise fall back to regular reboot.
106+ /// 'required' fails if soft reboot unavailable, 'auto' falls back to regular reboot.
115107 #[ clap( long = "soft-reboot" ) ]
116108 pub ( crate ) soft_reboot : Option < SoftRebootMode > ,
117109
@@ -161,8 +153,7 @@ pub(crate) struct RollbackOpts {
161153
162154 /// Configure soft reboot behavior.
163155 ///
164- /// 'required' will fail if soft reboot is not available.
165- /// 'auto' will use soft reboot if available, otherwise fall back to regular reboot.
156+ /// 'required' fails if soft reboot unavailable, 'auto' falls back to regular reboot.
166157 #[ clap( long = "soft-reboot" ) ]
167158 pub ( crate ) soft_reboot : Option < SoftRebootMode > ,
168159}
@@ -279,14 +270,6 @@ pub(crate) enum InstallOpts {
279270 PrintConfiguration ,
280271}
281272
282- /// Options for man page generation
283- #[ derive( Debug , Parser , PartialEq , Eq ) ]
284- pub ( crate ) struct ManOpts {
285- #[ clap( long) ]
286- /// Output to this directory
287- pub ( crate ) directory : Utf8PathBuf ,
288- }
289-
290273/// Subcommands which can be executed as part of a container build.
291274#[ derive( Debug , clap:: Subcommand , PartialEq , Eq ) ]
292275pub ( crate ) enum ContainerOpts {
@@ -540,6 +523,9 @@ pub(crate) enum InternalsOpts {
540523 #[ clap( long) ]
541524 merge : bool ,
542525 } ,
526+ #[ cfg( feature = "docgen" ) ]
527+ /// Dump CLI structure as JSON for documentation generation
528+ DumpCliJson ,
543529}
544530
545531#[ derive( Debug , clap:: Subcommand , PartialEq , Eq ) ]
@@ -625,70 +611,26 @@ pub(crate) enum Opt {
625611 ///
626612 /// Only changes to the `spec` section are honored.
627613 Edit ( EditOpts ) ,
628- /// Display status
629- ///
630- /// If standard output is a terminal, this will output a description of the bootc system state.
631- /// If standard output is not a terminal, output a YAML-formatted object using a schema
632- /// intended to match a Kubernetes resource that describes the state of the booted system.
633- ///
634- /// ## Parsing output via programs
635- ///
636- /// Either the default YAML format or `--format=json` can be used. Do not attempt to
637- /// explicitly parse the output of `--format=humanreadable` as it will very likely
638- /// change over time.
614+ /// Display status.
639615 ///
640- /// ## Programmatically detecting whether the system is deployed via bootc
641- ///
642- /// Invoke e.g. `bootc status --json`, and check if `status.booted` is not `null`.
616+ /// Shows bootc system state. Outputs YAML by default, human-readable if terminal detected.
643617 Status ( StatusOpts ) ,
644- /// Adds a transient writable overlayfs on `/usr` that will be discarded on reboot.
645- ///
646- /// ## Use cases
647- ///
648- /// A common pattern is wanting to use tracing/debugging tools, such as `strace`
649- /// that may not be in the base image. A system package manager such as `apt` or
650- /// `dnf` can apply changes into this transient overlay that will be discarded on
651- /// reboot.
652- ///
653- /// ## /etc and /var
654- ///
655- /// However, this command has no effect on `/etc` and `/var` - changes written
656- /// there will persist. It is common for package installations to modify these
657- /// directories.
658- ///
659- /// ## Unmounting
660- ///
661- /// Almost always, a system process will hold a reference to the open mount point.
662- /// You can however invoke `umount -l /usr` to perform a "lazy unmount".
618+ /// Add a transient writable overlayfs on `/usr`.
663619 ///
620+ /// Allows temporary package installation that will be discarded on reboot.
664621 #[ clap( alias = "usroverlay" ) ]
665622 UsrOverlay ,
666623 /// Install the running container to a target.
667624 ///
668- /// ## Understanding installations
669- ///
670- /// OCI containers are effectively layers of tarballs with JSON for metadata; they
671- /// cannot be booted directly. The `bootc install` flow is a highly opinionated
672- /// method to take the contents of the container image and install it to a target
673- /// block device (or an existing filesystem) in such a way that it can be booted.
674- ///
675- /// For example, a Linux partition table and filesystem is used, and the bootloader and kernel
676- /// embedded in the container image are also prepared.
677- ///
678- /// A bootc installed container currently uses OSTree as a backend, and this sets
679- /// it up such that a subsequent `bootc upgrade` can perform in-place updates.
680- ///
681- /// An installation is not simply a copy of the container filesystem, but includes
682- /// other setup and metadata.
625+ /// Takes a container image and installs it to disk in a bootable format.
683626 #[ clap( subcommand) ]
684627 Install ( InstallOpts ) ,
685628 /// Operations which can be executed as part of a container build.
686629 #[ clap( subcommand) ]
687630 Container ( ContainerOpts ) ,
688- /// Operations on container images
631+ /// Operations on container images.
689632 ///
690- /// Stability: This interface is not declared stable and may change or be removed
691- /// at any point in the future.
633+ /// Stability: This interface may change in the future.
692634 #[ clap( subcommand, hide = true ) ]
693635 Image ( ImageOpts ) ,
694636 /// Execute the given command in the host mount namespace
@@ -704,9 +646,6 @@ pub(crate) enum Opt {
704646 #[ clap( subcommand) ]
705647 #[ clap( hide = true ) ]
706648 Internals ( InternalsOpts ) ,
707- #[ clap( hide( true ) ) ]
708- #[ cfg( feature = "docgen" ) ]
709- Man ( ManOpts ) ,
710649}
711650
712651/// Ensure we've entered a mount namespace, so that we can remount
@@ -1499,6 +1438,14 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
14991438 }
15001439 #[ cfg( feature = "rhsm" ) ]
15011440 InternalsOpts :: PublishRhsmFacts => crate :: rhsm:: publish_facts ( & root) . await ,
1441+ #[ cfg( feature = "docgen" ) ]
1442+ InternalsOpts :: DumpCliJson => {
1443+ use clap:: CommandFactory ;
1444+ let cmd = Opt :: command ( ) ;
1445+ let json = crate :: cli_json:: dump_cli_json ( & cmd) ?;
1446+ println ! ( "{}" , json) ;
1447+ Ok ( ( ) )
1448+ }
15021449 InternalsOpts :: DirDiff {
15031450 pristine_etc,
15041451 current_etc,
@@ -1522,8 +1469,6 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
15221469 Ok ( ( ) )
15231470 }
15241471 } ,
1525- #[ cfg( feature = "docgen" ) ]
1526- Opt :: Man ( manopts) => crate :: docgen:: generate_manpages ( & manopts. directory ) ,
15271472 Opt :: State ( opts) => match opts {
15281473 StateOpts :: WipeOstree => {
15291474 let sysroot = ostree:: Sysroot :: new_default ( ) ;
0 commit comments