File tree Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ use std::{
2626 path:: { Path , PathBuf } ,
2727} ;
2828
29- use clap:: { builder:: TypedValueParser , Parser , Subcommand } ;
29+ use clap:: { builder:: TypedValueParser , ArgAction , Parser , Subcommand } ;
3030use color_eyre:: {
3131 eyre:: { ensure, eyre, WrapErr } ,
3232 Help ,
@@ -399,6 +399,7 @@ enum PodmanCommands {
399399 ///
400400 /// For details on options see:
401401 /// https://docs.podman.io/en/stable/markdown/podman-systemd.unit.5.html
402+ #[ command( disable_help_flag = true ) ]
402403 Run {
403404 /// The \[Container\] section
404405 #[ command( flatten) ]
@@ -407,6 +408,17 @@ enum PodmanCommands {
407408 /// The \[Service\] section
408409 #[ command( flatten) ]
409410 service : Service ,
411+
412+ /// Print help
413+ // Changed from default to support `podman run -h`, i.e. `podman run --hostname`.
414+ #[ arg(
415+ short = '?' ,
416+ long,
417+ action = ArgAction :: Help ,
418+ help = "Print help (see more with '--help')" ,
419+ long_help = "Print help (see a summary with '-?')"
420+ ) ]
421+ help : ( ) ,
410422 } ,
411423
412424 /// Generate a Podman Quadlet `.pod` file
Original file line number Diff line number Diff line change @@ -230,7 +230,7 @@ pub struct QuadletOptions {
230230 /// Set the host name that is available inside the container
231231 ///
232232 /// Converts to "HostName=NAME"
233- #[ arg( long, value_name = "NAME" ) ]
233+ #[ arg( short , long, value_name = "NAME" ) ]
234234 hostname : Option < String > ,
235235
236236 /// Specify a static IPv4 address for the container
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ impl Generate {
164164
165165/// [`Parser`] for container creation CLI options.
166166#[ derive( Parser , Debug ) ]
167- #[ command( no_binary_name = true ) ]
167+ #[ command( no_binary_name = true , disable_help_flag = true ) ]
168168struct ContainerParser {
169169 /// Podman global options
170170 #[ command( flatten) ]
@@ -284,7 +284,7 @@ impl ContainerInspect {
284284
285285/// [`Parser`] for pod creation CLI options.
286286#[ derive( Parser , Debug ) ]
287- #[ command( no_binary_name = true ) ]
287+ #[ command( no_binary_name = true , disable_help_flag = true ) ]
288288struct PodParser {
289289 /// Podman global options
290290 #[ command( flatten) ]
@@ -874,4 +874,9 @@ mod tests {
874874 fn verify_container_parser_cli ( ) {
875875 ContainerParser :: command ( ) . debug_assert ( ) ;
876876 }
877+
878+ #[ test]
879+ fn verify_pod_parser_cli ( ) {
880+ PodParser :: command ( ) . debug_assert ( ) ;
881+ }
877882}
You can’t perform that action at this time.
0 commit comments