Skip to content

Commit 36198f7

Browse files
committed
add basic cli info
1 parent c2163b6 commit 36198f7

File tree

2 files changed

+66
-5
lines changed

2 files changed

+66
-5
lines changed

Cargo.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@ name = "rust-pip"
33
version = "0.0.1"
44
edition = "2021"
55
description = "WORK IN PROGRESS: Pip rewritten in Rust"
6-
authors = [
7-
"Jan Bronicki janbronicki@gmail.com",
8-
]
6+
authors = ["Jan Bronicki janbronicki@gmail.com"]
97
license = "MIT"
108
readme = "README.md"
11-
9+
repository = "https://github.com/John15321/rust-pip"
1210

1311
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1412

1513
[dependencies]
14+
anyhow = { version = "1.0.58", features = ["backtrace"] }
15+
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"
1619

1720

1821
[dev-dependencies]

src/main.rs

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,61 @@
1+
use std::path::PathBuf;
2+
use structopt::StructOpt;
3+
4+
/// A basic example
5+
#[derive(StructOpt, Debug)]
6+
#[structopt(name = "rust-pip", about = "Python package manager written in Rust.")]
7+
enum Opt {
8+
/// Install packages.
9+
Install {},
10+
/// Download packages.
11+
Download {
12+
#[structopt(short = "n", long = "name")]
13+
name: String,
14+
#[structopt(short = "i", long = "index", default_value = "https://pypi.org/")]
15+
index: String,
16+
},
17+
/// Uninstall packages.
18+
Uninstall {},
19+
/// List installed packages.
20+
List {},
21+
/// Show information about installed packages.
22+
Show {},
23+
/// Output installed packages in requirements format.
24+
Freeze {},
25+
/// Verify installed packages have compatible dependencies.
26+
Check {},
27+
/// Manage local and global configuration.
28+
Config {},
29+
/// Search PyPI for packages.
30+
Search {},
31+
/// Inspect and manage pip's wheel cache.
32+
Cache {},
33+
/// Inspect information available from package indexes.
34+
Index {},
35+
/// Build wheels from your requirements.
36+
Wheel {},
37+
/// Compute hashes of package archives.
38+
Hash {},
39+
/// A helper command used for command completion.
40+
Completion {},
41+
/// Show information useful for debugging.
42+
Debug {},
43+
/// Show help for commands.
44+
Help {},
45+
}
46+
47+
fn download_package(package_name: String, package_index: &String) {}
48+
149
fn main() {
2-
println!("Hello, world!");
50+
let opt = Opt::from_args();
51+
println!("{:#?}", opt);
52+
53+
match opt {
54+
Opt::Download { name, index } => {
55+
println!("Package name {:?}", name);
56+
println!("Index name: {:?}", index);
57+
download_package(name, &index);
58+
}
59+
_ => todo!(),
60+
}
361
}

0 commit comments

Comments
 (0)