@@ -39,10 +39,9 @@ use crate::utils::sigpolicy_from_opt;
39
39
/// Shared progress options
40
40
#[ derive( Debug , Parser , PartialEq , Eq ) ]
41
41
pub ( 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.
43
43
///
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.
46
45
#[ clap( long, hide = true ) ]
47
46
pub ( crate ) progress_fd : Option < RawProgressFd > ,
48
47
}
@@ -69,23 +68,19 @@ pub(crate) struct UpgradeOpts {
69
68
70
69
/// Check if an update is available without applying it.
71
70
///
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.
74
72
#[ clap( long, conflicts_with = "apply" ) ]
75
73
pub ( crate ) check : bool ,
76
74
77
75
/// Restart or reboot into the new target image.
78
76
///
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.
82
78
#[ clap( long, conflicts_with = "check" ) ]
83
79
pub ( crate ) apply : bool ,
84
80
85
81
/// Configure soft reboot behavior.
86
82
///
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.
89
84
#[ clap( long = "soft-reboot" , conflicts_with = "check" ) ]
90
85
pub ( crate ) soft_reboot : Option < SoftRebootMode > ,
91
86
@@ -102,16 +97,13 @@ pub(crate) struct SwitchOpts {
102
97
103
98
/// Restart or reboot into the new target image.
104
99
///
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.
108
101
#[ clap( long) ]
109
102
pub ( crate ) apply : bool ,
110
103
111
104
/// Configure soft reboot behavior.
112
105
///
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.
115
107
#[ clap( long = "soft-reboot" ) ]
116
108
pub ( crate ) soft_reboot : Option < SoftRebootMode > ,
117
109
@@ -161,8 +153,7 @@ pub(crate) struct RollbackOpts {
161
153
162
154
/// Configure soft reboot behavior.
163
155
///
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.
166
157
#[ clap( long = "soft-reboot" ) ]
167
158
pub ( crate ) soft_reboot : Option < SoftRebootMode > ,
168
159
}
@@ -279,14 +270,6 @@ pub(crate) enum InstallOpts {
279
270
PrintConfiguration ,
280
271
}
281
272
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
-
290
273
/// Subcommands which can be executed as part of a container build.
291
274
#[ derive( Debug , clap:: Subcommand , PartialEq , Eq ) ]
292
275
pub ( crate ) enum ContainerOpts {
@@ -540,6 +523,9 @@ pub(crate) enum InternalsOpts {
540
523
#[ clap( long) ]
541
524
merge : bool ,
542
525
} ,
526
+ #[ cfg( feature = "docgen" ) ]
527
+ /// Dump CLI structure as JSON for documentation generation
528
+ DumpCliJson ,
543
529
}
544
530
545
531
#[ derive( Debug , clap:: Subcommand , PartialEq , Eq ) ]
@@ -625,70 +611,26 @@ pub(crate) enum Opt {
625
611
///
626
612
/// Only changes to the `spec` section are honored.
627
613
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.
639
615
///
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.
643
617
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`.
663
619
///
620
+ /// Allows temporary package installation that will be discarded on reboot.
664
621
#[ clap( alias = "usroverlay" ) ]
665
622
UsrOverlay ,
666
623
/// Install the running container to a target.
667
624
///
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.
683
626
#[ clap( subcommand) ]
684
627
Install ( InstallOpts ) ,
685
628
/// Operations which can be executed as part of a container build.
686
629
#[ clap( subcommand) ]
687
630
Container ( ContainerOpts ) ,
688
- /// Operations on container images
631
+ /// Operations on container images.
689
632
///
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.
692
634
#[ clap( subcommand, hide = true ) ]
693
635
Image ( ImageOpts ) ,
694
636
/// Execute the given command in the host mount namespace
@@ -704,9 +646,6 @@ pub(crate) enum Opt {
704
646
#[ clap( subcommand) ]
705
647
#[ clap( hide = true ) ]
706
648
Internals ( InternalsOpts ) ,
707
- #[ clap( hide( true ) ) ]
708
- #[ cfg( feature = "docgen" ) ]
709
- Man ( ManOpts ) ,
710
649
}
711
650
712
651
/// Ensure we've entered a mount namespace, so that we can remount
@@ -1499,6 +1438,14 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
1499
1438
}
1500
1439
#[ cfg( feature = "rhsm" ) ]
1501
1440
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
+ }
1502
1449
InternalsOpts :: DirDiff {
1503
1450
pristine_etc,
1504
1451
current_etc,
@@ -1522,8 +1469,6 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
1522
1469
Ok ( ( ) )
1523
1470
}
1524
1471
} ,
1525
- #[ cfg( feature = "docgen" ) ]
1526
- Opt :: Man ( manopts) => crate :: docgen:: generate_manpages ( & manopts. directory ) ,
1527
1472
Opt :: State ( opts) => match opts {
1528
1473
StateOpts :: WipeOstree => {
1529
1474
let sysroot = ostree:: Sysroot :: new_default ( ) ;
0 commit comments