My personal project and infrastructure archive
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nomicon/development/tools/cargo-workspace2/src/bin/cargo-ws2.rs

42 lines
1.0 KiB

// extern crate cargo_ws_release;
// #[macro_use]
// extern crate clap;
// extern crate toml;
// extern crate toml_edit;
// use cargo_ws_release::data_models::level::*;
// use cargo_ws_release::do_batch_release;
// use clap::{App, Arg};
// use std::fs::File;
// use std::process;
use cargo_workspace2 as ws2;
use std::env::{args, current_dir};
use ws2::cli::{self, CmdSet};
use ws2::models::{CargoWorkspace, CrateId, Workspace};
use ws2::{ops::Op, query::Query};
fn main() {
let CmdSet { debug, line } = cli::parse_env_args();
let (q, rest) = Query::parse(line.into_iter());
let path = current_dir().unwrap();
let ws = Workspace::process(match CargoWorkspace::open(path) {
Ok(c) => c,
Err(e) => {
eprintln!("An error occured: {}", e);
std::process::exit(1);
}
});
let set = ws.query(q);
let op = Op::parse(rest);
mutate(ws, op, set);
}
/// Consume a workspace to mutate it
fn mutate(mut ws: Workspace, op: Op, set: Vec<CrateId>) {
ws.execute(op, set);
}