@@ -14,21 +14,19 @@ use cargo::CargoResult;
14
14
15
15
pub fn cli ( ) -> Command {
16
16
clap:: Command :: new ( "add" )
17
- . setting ( clap:: AppSettings :: DeriveDisplayOrder )
18
17
. about ( "Add dependencies to a Cargo.toml manifest file" )
19
18
. override_usage (
20
19
"\
21
- cargo add [OPTIONS] <DEP>[@<VERSION>] ...
22
- cargo add [OPTIONS] --path <PATH> ...
23
- cargo add [OPTIONS] --git <URL> ..."
20
+ cargo add [OPTIONS] <DEP>[@<VERSION>] ...
21
+ cargo add [OPTIONS] --path <PATH> ...
22
+ cargo add [OPTIONS] --git <URL> ..."
24
23
)
25
24
. after_help ( "Run `cargo help add` for more detailed information.\n " )
26
25
. group ( clap:: ArgGroup :: new ( "selected" ) . multiple ( true ) . required ( true ) )
27
26
. args ( [
28
27
clap:: Arg :: new ( "crates" )
29
- . takes_value ( true )
30
28
. value_name ( "DEP_ID" )
31
- . multiple_values ( true )
29
+ . num_args ( 0 .. )
32
30
. help ( "Reference to a package to add as a dependency" )
33
31
. long_help (
34
32
"Reference to a package to add as a dependency
@@ -46,7 +44,6 @@ You can reference a package by:
46
44
clap:: Arg :: new ( "features" )
47
45
. short ( 'F' )
48
46
. long ( "features" )
49
- . takes_value ( true )
50
47
. value_name ( "FEATURES" )
51
48
. action ( ArgAction :: Append )
52
49
. help ( "Space or comma separated list of features to activate" ) ,
@@ -65,7 +62,7 @@ The package will be removed from your features.")
65
62
. overrides_with ( "optional" ) ,
66
63
clap:: Arg :: new ( "rename" )
67
64
. long ( "rename" )
68
- . takes_value ( true )
65
+ . action ( ArgAction :: Set )
69
66
. value_name ( "NAME" )
70
67
. help ( "Rename the dependency" )
71
68
. long_help ( "Rename the dependency
@@ -79,7 +76,7 @@ Example uses:
79
76
clap:: Arg :: new ( "package" )
80
77
. short ( 'p' )
81
78
. long ( "package" )
82
- . takes_value ( true )
79
+ . action ( ArgAction :: Set )
83
80
. value_name ( "SPEC" )
84
81
. help ( "Package to modify" ) ,
85
82
] )
@@ -89,14 +86,14 @@ Example uses:
89
86
. args ( [
90
87
clap:: Arg :: new ( "path" )
91
88
. long ( "path" )
92
- . takes_value ( true )
89
+ . action ( ArgAction :: Set )
93
90
. value_name ( "PATH" )
94
91
. help ( "Filesystem path to local crate to add" )
95
92
. group ( "selected" )
96
93
. conflicts_with ( "git" ) ,
97
94
clap:: Arg :: new ( "git" )
98
95
. long ( "git" )
99
- . takes_value ( true )
96
+ . action ( ArgAction :: Set )
100
97
. value_name ( "URI" )
101
98
. help ( "Git repository location" )
102
99
. long_help ( "Git repository location
@@ -105,21 +102,21 @@ Without any other information, cargo will use latest commit on the main branch."
105
102
. group ( "selected" ) ,
106
103
clap:: Arg :: new ( "branch" )
107
104
. long ( "branch" )
108
- . takes_value ( true )
105
+ . action ( ArgAction :: Set )
109
106
. value_name ( "BRANCH" )
110
107
. help ( "Git branch to download the crate from" )
111
108
. requires ( "git" )
112
109
. group ( "git-ref" ) ,
113
110
clap:: Arg :: new ( "tag" )
114
111
. long ( "tag" )
115
- . takes_value ( true )
112
+ . action ( ArgAction :: Set )
116
113
. value_name ( "TAG" )
117
114
. help ( "Git tag to download the crate from" )
118
115
. requires ( "git" )
119
116
. group ( "git-ref" ) ,
120
117
clap:: Arg :: new ( "rev" )
121
118
. long ( "rev" )
122
- . takes_value ( true )
119
+ . action ( ArgAction :: Set )
123
120
. value_name ( "REV" )
124
121
. help ( "Git reference to download the crate from" )
125
122
. long_help ( "Git reference to download the crate from
@@ -129,7 +126,7 @@ This is the catch all, handling hashes to named references in remote repositorie
129
126
. group ( "git-ref" ) ,
130
127
clap:: Arg :: new ( "registry" )
131
128
. long ( "registry" )
132
- . takes_value ( true )
129
+ . action ( ArgAction :: Set )
133
130
. value_name ( "NAME" )
134
131
. help ( "Package registry for this dependency" ) ,
135
132
] )
@@ -151,7 +148,7 @@ Build-dependencies are the only dependencies available for use by build scripts
151
148
. group ( "section" ) ,
152
149
clap:: Arg :: new ( "target" )
153
150
. long ( "target" )
154
- . takes_value ( true )
151
+ . action ( ArgAction :: Set )
155
152
. value_name ( "TARGET" )
156
153
. value_parser ( clap:: builder:: NonEmptyStringValueParser :: new ( ) )
157
154
. help ( "Add as dependency to the given target platform" )
0 commit comments