Skip to content

Commit

Permalink
add basic cli info
Browse files Browse the repository at this point in the history
  • Loading branch information
John15321 committed Jul 31, 2022
1 parent c2163b6 commit 36198f7
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 5 deletions.
11 changes: 7 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@ name = "rust-pip"
version = "0.0.1"
edition = "2021"
description = "WORK IN PROGRESS: Pip rewritten in Rust"
authors = [
"Jan Bronicki janbronicki@gmail.com",
]
authors = ["Jan Bronicki janbronicki@gmail.com"]
license = "MIT"
readme = "README.md"

repository = "https://github.com/John15321/rust-pip"

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

[dependencies]
anyhow = { version = "1.0.58", features = ["backtrace"] }
reqwest = { version = "0.11", features = ["blocking", "json"] }
structopt = { version = "0.3.26", features = ["color"] }
strum = "0.24.1"
strum_macros = "0.24.2"


[dev-dependencies]
60 changes: 59 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,61 @@
use std::path::PathBuf;
use structopt::StructOpt;

/// A basic example
#[derive(StructOpt, Debug)]
#[structopt(name = "rust-pip", about = "Python package manager written in Rust.")]
enum Opt {
/// Install packages.
Install {},
/// Download packages.
Download {
#[structopt(short = "n", long = "name")]
name: String,
#[structopt(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: &String) {}

fn main() {
println!("Hello, world!");
let opt = Opt::from_args();
println!("{:#?}", opt);

match opt {
Opt::Download { name, index } => {
println!("Package name {:?}", name);
println!("Index name: {:?}", index);
download_package(name, &index);
}
_ => todo!(),
}
}

0 comments on commit 36198f7

Please sign in to comment.