cmd to install code extension

This commit is contained in:
Aleksey Kladov 2018-07-30 22:17:33 +03:00
parent ac0d8c48f7
commit 72d49c5a10
3 changed files with 23 additions and 0 deletions

View file

@ -1,5 +1,7 @@
[alias]
gen-kinds = "run --package tools -- gen-kinds"
gen-tests = "run --package tools -- gen-tests"
install-code = "run --package tools -- install-code"
render-test = "run --package cli -- render-test"
parse = "run --package cli -- parse"

View file

@ -11,3 +11,4 @@ itertools = "0.7.8"
tera = "0.11"
clap = "2.32.0"
failure = "0.1.1"
commandspec = "0.10"

View file

@ -5,6 +5,8 @@ extern crate ron;
extern crate tera;
extern crate walkdir;
extern crate tools;
#[macro_use]
extern crate commandspec;
use std::{collections::{HashSet, HashMap}, fs, path::Path};
use clap::{App, Arg, SubCommand};
@ -29,8 +31,10 @@ fn main() -> Result<()> {
)
.subcommand(SubCommand::with_name("gen-kinds"))
.subcommand(SubCommand::with_name("gen-tests"))
.subcommand(SubCommand::with_name("install-code"))
.get_matches();
match matches.subcommand() {
("install-code", _) => install_code_extension()?,
(name, Some(matches)) => run_gen_command(name, matches.is_present("verify"))?,
_ => unreachable!(),
}
@ -149,3 +153,19 @@ fn existing_tests(dir: &Path) -> Result<HashSet<Test>> {
}
Ok(res)
}
fn install_code_extension() -> Result<()> {
execute!(r"
cd code
npm install
")?;
execute!(r"
cd code
./node_modules/vsce/out/vsce package
")?;
execute!(r"
cd code
code --install-extension ./libsyntax-rust-0.0.1.vsix
")?;
Ok(())
}