11/// This module defines the command-line arguments and behavior of `newdoc`.
22/// It relies on the `clap` crate.
3- use clap:: { app_from_crate, App , AppSettings , Arg , ArgGroup , ArgMatches } ;
3+ use clap:: { app_from_crate, AppSettings , Arg , ArgGroup , ArgMatches } ;
44
55/// Define the command-line arguments and return them as the `clap::ArgMatches` struct.
66pub fn get_args ( ) -> ArgMatches {
@@ -9,111 +9,111 @@ pub fn get_args() -> ArgMatches {
99 // If no arguments are provided, print help
1010 . setting ( AppSettings :: ArgRequiredElseHelp )
1111 . arg (
12- Arg :: with_name ( "assembly" )
12+ Arg :: new ( "assembly" )
1313 . short ( 'a' )
1414 . long ( "assembly" )
1515 . takes_value ( true )
1616 . value_name ( "title" )
17- . multiple ( true )
17+ . multiple_occurrences ( true )
1818 . help ( "Create an assembly file" ) ,
1919 )
2020 . arg (
21- Arg :: with_name ( "include-in" )
21+ Arg :: new ( "include-in" )
2222 . short ( 'i' )
2323 . long ( "include-in" )
2424 . takes_value ( true )
2525 . value_name ( "title" )
26- . multiple ( false )
26+ . multiple_occurrences ( false )
2727 . help ( "Create an assembly that includes the other specified modules" ) ,
2828 )
2929 . arg (
30- Arg :: with_name ( "concept" )
30+ Arg :: new ( "concept" )
3131 . short ( 'c' )
3232 . long ( "concept" )
3333 . takes_value ( true )
3434 . value_name ( "title" )
35- . multiple ( true )
35+ . multiple_occurrences ( true )
3636 . help ( "Create a concept module" ) ,
3737 )
3838 . arg (
39- Arg :: with_name ( "procedure" )
39+ Arg :: new ( "procedure" )
4040 . short ( 'p' )
4141 . long ( "procedure" )
4242 . takes_value ( true )
4343 . value_name ( "title" )
44- . multiple ( true )
44+ . multiple_occurrences ( true )
4545 . help ( "Create a procedure module" ) ,
4646 )
4747 . arg (
48- Arg :: with_name ( "reference" )
48+ Arg :: new ( "reference" )
4949 . short ( 'r' )
5050 . long ( "reference" )
5151 . takes_value ( true )
5252 . value_name ( "title" )
53- . multiple ( true )
53+ . multiple_occurrences ( true )
5454 . help ( "Create a reference module" ) ,
5555 )
5656 . arg (
57- Arg :: with_name ( "validate" )
57+ Arg :: new ( "validate" )
5858 . short ( 'l' )
5959 . long ( "validate" )
6060 . takes_value ( true )
6161 . value_name ( "file" )
62- . multiple ( true )
62+ . multiple_occurrences ( true )
6363 . help ( "Validate (lint) an existing module or assembly file" )
6464 )
6565 // This group specifies that you either generate modules or validate existing ones
6666 . group (
67- ArgGroup :: with_name ( "required" )
67+ ArgGroup :: new ( "required" )
6868 . args ( & [ "assembly" , "concept" , "procedure" , "reference" , "validate" ] )
6969 . required ( true )
7070 . multiple ( true ) ,
7171 )
7272 . arg (
73- Arg :: with_name ( "no-comments" )
73+ Arg :: new ( "no-comments" )
7474 . short ( 'C' )
7575 . long ( "no-comments" )
7676 . help ( "Generate the file without any comments" ) ,
7777 )
7878 . arg (
79- Arg :: with_name ( "no-examples" )
79+ Arg :: new ( "no-examples" )
8080 . short ( 'E' )
8181 . long ( "no-examples" )
8282 . alias ( "expert-mode" )
8383 . help ( "Generate the file without any example, placeholder content" ) ,
8484 )
8585 . arg (
86- Arg :: with_name ( "detect-directory" )
86+ Arg :: new ( "detect-directory" )
8787 . short ( 'D' )
8888 . long ( "detect-directory" )
8989 . help ( "Detect the include path, rather than using the <path> placeholder. This is now the default behavior" )
9090 // I'm enabling this option by default, without a way to disable it.
9191 // Let the users test the new behavior and evaluate.
92- . hidden ( true ) ,
92+ . hide ( true ) ,
9393 )
9494 . arg (
95- Arg :: with_name ( "no-prefixes" )
95+ Arg :: new ( "no-prefixes" )
9696 . short ( 'P' )
9797 . long ( "no-prefixes" )
9898 . help ( "Do not use module type prefixes (such as `proc_`) in IDs and file names" ) ,
9999 )
100100 . arg (
101- Arg :: with_name ( "target-dir" )
101+ Arg :: new ( "target-dir" )
102102 . short ( 'T' )
103103 . long ( "target-dir" )
104104 . takes_value ( true )
105105 . value_name ( "directory" )
106106 . help ( "Save the generated files in this directory" ) ,
107107 )
108108 . arg (
109- Arg :: with_name ( "verbose" )
109+ Arg :: new ( "verbose" )
110110 . short ( 'v' )
111111 . long ( "verbose" )
112112 . help ( "Display additional, debug messages" )
113113 . conflicts_with ( "quiet" ) ,
114114 )
115115 . arg (
116- Arg :: with_name ( "quiet" )
116+ Arg :: new ( "quiet" )
117117 . short ( 'q' )
118118 . long ( "quiet" )
119119 . help ( "Hide info-level messages. Display only warnings and errors" )
0 commit comments