File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed
Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change 11use argh:: FromArgs ;
22
3- #[ derive( FromArgs , Debug ) ]
3+ #[ derive( FromArgs , PartialEq , Debug ) ]
44#[ argh(
55 description = "{command_name} is a tool to reach new heights.\n \n \
66 Start exploring new heights:\n \n \
@@ -11,7 +11,7 @@ use argh::FromArgs;
1111 {command_name} --height 5 j\n \
1212 {command_name} --height 5 --pilot-nickname Wes jump"
1313) ]
14- pub struct CliArgs {
14+ struct CliArgs {
1515 /// how high to go
1616 #[ argh( option) ]
1717 height : usize ,
@@ -20,19 +20,19 @@ pub struct CliArgs {
2020 pilot_nickname : Option < String > ,
2121 /// command to execute
2222 #[ argh( subcommand) ]
23- pub command : Command ,
23+ command : Command ,
2424}
2525
26- #[ derive( FromArgs , Debug ) ]
26+ #[ derive( FromArgs , PartialEq , Debug ) ]
2727#[ argh( subcommand) ]
28- pub enum Command {
28+ enum Command {
2929 Jump ( JumpCmd ) ,
3030}
3131
32- #[ derive( FromArgs , Debug ) ]
32+ #[ derive( FromArgs , PartialEq , Debug ) ]
3333#[ argh( subcommand, name = "jump" , short = 'j' ) ]
3434/// whether or not to jump
35- pub struct JumpCmd { }
35+ struct JumpCmd { }
3636
3737fn main ( ) {
3838 let args: CliArgs = argh:: from_env ( ) ;
Original file line number Diff line number Diff line change 322322//!
323323//! ```rust
324324//! # use argh::FromArgs;
325- //! #[derive(FromArgs, Debug)]
325+ //! #[derive(FromArgs, PartialEq, Debug)]
326326//! #[argh(
327327//! description = "{command_name} is a tool to reach new heights.\n\n\
328328//! Start exploring new heights:\n\n\
333333//! {command_name} --height 5 j\n\
334334//! {command_name} --height 5 --pilot-nickname Wes jump"
335335//! )]
336- //! pub struct CliArgs {
336+ //! struct CliArgs {
337337//! /// how high to go
338338//! #[argh(option)]
339339//! height: usize,
342342//! pilot_nickname: Option<String>,
343343//! /// command to execute
344344//! #[argh(subcommand)]
345- //! pub command: Command,
345+ //! command: Command,
346346//! }
347+ //!
348+ //! # #[derive(FromArgs, PartialEq, Debug)]
349+ //! # #[argh(subcommand)]
350+ //! # enum Command {}
347351//! ```
348352//!
349353//! Output:
You can’t perform that action at this time.
0 commit comments