diff options
author | Aleksey Kladov <[email protected]> | 2018-07-30 20:17:33 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-07-30 20:17:33 +0100 |
commit | 72d49c5a107efdd6a2900183939935f0f6d13d5b (patch) | |
tree | 7d9a27b0e981d879e81faf4d042d2419625609dc /tools/src | |
parent | ac0d8c48f7a277d4a43448fe7dd4279383bc53f0 (diff) |
cmd to install code extension
Diffstat (limited to 'tools/src')
-rw-r--r-- | tools/src/main.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/src/main.rs b/tools/src/main.rs index 7d7b2afc0..84a0cf1b6 100644 --- a/tools/src/main.rs +++ b/tools/src/main.rs | |||
@@ -5,6 +5,8 @@ extern crate ron; | |||
5 | extern crate tera; | 5 | extern crate tera; |
6 | extern crate walkdir; | 6 | extern crate walkdir; |
7 | extern crate tools; | 7 | extern crate tools; |
8 | #[macro_use] | ||
9 | extern crate commandspec; | ||
8 | 10 | ||
9 | use std::{collections::{HashSet, HashMap}, fs, path::Path}; | 11 | use std::{collections::{HashSet, HashMap}, fs, path::Path}; |
10 | use clap::{App, Arg, SubCommand}; | 12 | use clap::{App, Arg, SubCommand}; |
@@ -29,8 +31,10 @@ fn main() -> Result<()> { | |||
29 | ) | 31 | ) |
30 | .subcommand(SubCommand::with_name("gen-kinds")) | 32 | .subcommand(SubCommand::with_name("gen-kinds")) |
31 | .subcommand(SubCommand::with_name("gen-tests")) | 33 | .subcommand(SubCommand::with_name("gen-tests")) |
34 | .subcommand(SubCommand::with_name("install-code")) | ||
32 | .get_matches(); | 35 | .get_matches(); |
33 | match matches.subcommand() { | 36 | match matches.subcommand() { |
37 | ("install-code", _) => install_code_extension()?, | ||
34 | (name, Some(matches)) => run_gen_command(name, matches.is_present("verify"))?, | 38 | (name, Some(matches)) => run_gen_command(name, matches.is_present("verify"))?, |
35 | _ => unreachable!(), | 39 | _ => unreachable!(), |
36 | } | 40 | } |
@@ -149,3 +153,19 @@ fn existing_tests(dir: &Path) -> Result<HashSet<Test>> { | |||
149 | } | 153 | } |
150 | Ok(res) | 154 | Ok(res) |
151 | } | 155 | } |
156 | |||
157 | fn install_code_extension() -> Result<()> { | ||
158 | execute!(r" | ||
159 | cd code | ||
160 | npm install | ||
161 | ")?; | ||
162 | execute!(r" | ||
163 | cd code | ||
164 | ./node_modules/vsce/out/vsce package | ||
165 | ")?; | ||
166 | execute!(r" | ||
167 | cd code | ||
168 | code --install-extension ./libsyntax-rust-0.0.1.vsix | ||
169 | ")?; | ||
170 | Ok(()) | ||
171 | } | ||