Skip to content

Commit

Permalink
Adding add command
Browse files Browse the repository at this point in the history
  • Loading branch information
Virviil authored and David-OConnor committed Dec 4, 2021
1 parent 030d19e commit c63e66b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
10 changes: 10 additions & 0 deletions src/cli_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ pub enum SubCommand {
name: String, // holds the project name.
},

/// Add packages to `pyproject.toml` and sync an environment
#[structopt(name = "add")]
Add {
#[structopt(name = "packages")]
packages: Vec<String>, // holds the packages names.
/// Save package to your dev-dependencies section
#[structopt(short, long)]
dev: bool
},

/** Install packages from `pyproject.toml`, `pyflow.lock`, or specified ones. Example:
`pyflow install`: sync your installation with `pyproject.toml`, or `pyflow.lock` if it exists.
Expand Down
28 changes: 15 additions & 13 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,19 +181,21 @@ fn main() {
// We use data from three sources: `pyproject.toml`, `pyflow.lock`, and
// the currently-installed packages, found by crawling metadata in the `lib` path.
// See the readme section `How installation and locking work` for details.
SubCommand::Install { packages, dev } => actions::install(
&pcfg.config_path,
&pcfg.config,
&git_path,
&paths,
found_lock,
&packages,
dev,
&lockpacks,
&os,
&py_vers,
&pcfg.lock_path,
),
SubCommand::Install { packages, dev } | SubCommand::Add { packages, dev } => {
actions::install(
&pcfg.config_path,
&pcfg.config,
&git_path,
&paths,
found_lock,
&packages,
dev,
&lockpacks,
&os,
&py_vers,
&pcfg.lock_path,
)
}

SubCommand::Uninstall { packages } => {
// todo: uninstall dev?
Expand Down

0 comments on commit c63e66b

Please sign in to comment.