File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,9 @@ repository = "https://github.com/John15321/rust-pip"
12
12
13
13
[dependencies ]
14
14
anyhow = { version = " 1.0.58" , features = [" backtrace" ] }
15
+ clap = { version = " 3.2" , features = [" derive" ] }
15
16
reqwest = { version = " 0.11" , features = [" blocking" , " json" ] }
16
- structopt = { version = " 0.3.26" , features = [" color" ] }
17
- strum = " 0.24.1"
18
- strum_macros = " 0.24.2"
17
+ strum = { version = " 0.24.1" , features = [" derive" ] }
19
18
20
19
21
20
[dev-dependencies ]
Original file line number Diff line number Diff line change 1
1
use std:: path:: PathBuf ;
2
- use structopt :: StructOpt ;
2
+ use clap :: { AppSettings , Parser } ;
3
3
4
- /// A basic example
5
- #[ derive( StructOpt , Debug ) ]
6
- #[ structopt ( name = "rust-pip" , about = "Python package manager written in Rust." ) ]
4
+ /// Python package manager written in Rust
5
+ #[ derive( Parser , Debug ) ]
6
+ #[ clap ( global_setting = AppSettings :: DeriveDisplayOrder ) ]
7
7
enum Opt {
8
8
/// Install packages.
9
9
Install { } ,
10
10
/// Download packages.
11
11
Download {
12
- #[ structopt ( short = "n" , long = "name" ) ]
12
+ #[ clap ( short = 'n' , long = "name" ) ]
13
13
name : String ,
14
- #[ structopt ( short = "i" , long = "index" , default_value = "https://pypi.org/" ) ]
14
+ #[ clap ( short = 'i' , long = "index" , default_value = "https://pypi.org/" ) ]
15
15
index : String ,
16
16
} ,
17
17
/// Uninstall packages.
@@ -47,7 +47,7 @@ enum Opt {
47
47
fn download_package ( package_name : String , package_index : & String ) { }
48
48
49
49
fn main ( ) {
50
- let opt = Opt :: from_args ( ) ;
50
+ let opt = Opt :: parse ( ) ;
51
51
println ! ( "{:#?}" , opt) ;
52
52
53
53
match opt {
You can’t perform that action at this time.
0 commit comments