-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmain.rs
More file actions
65 lines (60 loc) · 1.72 KB
/
main.rs
File metadata and controls
65 lines (60 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
use clap::{AppSettings, Parser};
use pyver::PackageVersion;
/// Python package manager written in Rust
#[derive(Parser, Debug)]
#[clap(global_setting = AppSettings::DeriveDisplayOrder)]
enum Opt {
/// Install packages.
Install {},
/// Download packages.
Download {
#[clap(short = 'n', long = "name")]
name: String,
#[clap(short = 'i', long = "index", default_value = "https://pypi.org/")]
index: String,
},
/// Uninstall packages.
Uninstall {},
/// List installed packages.
List {},
/// Show information about installed packages.
Show {},
/// Output installed packages in requirements format.
Freeze {},
/// Verify installed packages have compatible dependencies.
Check {},
/// Manage local and global configuration.
Config {},
/// Search PyPI for packages.
Search {},
/// Inspect and manage pip's wheel cache.
Cache {},
/// Inspect information available from package indexes.
Index {},
/// Build wheels from your requirements.
Wheel {},
/// Compute hashes of package archives.
Hash {},
/// A helper command used for command completion.
Completion {},
/// Show information useful for debugging.
Debug {},
/// Show help for commands.
Help {},
}
fn download_package(_package_name: String, _package_index: &str) {
// Version usage example
let _ = PackageVersion::new("v1.0");
}
fn main() {
let opt = Opt::parse();
println!("{:#?}", opt);
match opt {
Opt::Download { name, index } => {
println!("Package name {:?}", name);
println!("Index name: {:?}", index);
download_package(name, &index);
}
_ => todo!(),
}
}