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 | |
parent | ac0d8c48f7a277d4a43448fe7dd4279383bc53f0 (diff) |
cmd to install code extension
-rw-r--r-- | .cargo/config | 2 | ||||
-rw-r--r-- | tools/Cargo.toml | 1 | ||||
-rw-r--r-- | tools/src/main.rs | 20 |
3 files changed, 23 insertions, 0 deletions
diff --git a/.cargo/config b/.cargo/config index 7903b919c..0e9e0f387 100644 --- a/.cargo/config +++ b/.cargo/config | |||
@@ -1,5 +1,7 @@ | |||
1 | [alias] | 1 | [alias] |
2 | gen-kinds = "run --package tools -- gen-kinds" | 2 | gen-kinds = "run --package tools -- gen-kinds" |
3 | gen-tests = "run --package tools -- gen-tests" | 3 | gen-tests = "run --package tools -- gen-tests" |
4 | install-code = "run --package tools -- install-code" | ||
5 | |||
4 | render-test = "run --package cli -- render-test" | 6 | render-test = "run --package cli -- render-test" |
5 | parse = "run --package cli -- parse" | 7 | parse = "run --package cli -- parse" |
diff --git a/tools/Cargo.toml b/tools/Cargo.toml index 4fcddebf0..f9fee16f9 100644 --- a/tools/Cargo.toml +++ b/tools/Cargo.toml | |||
@@ -11,3 +11,4 @@ itertools = "0.7.8" | |||
11 | tera = "0.11" | 11 | tera = "0.11" |
12 | clap = "2.32.0" | 12 | clap = "2.32.0" |
13 | failure = "0.1.1" | 13 | failure = "0.1.1" |
14 | commandspec = "0.10" | ||
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 | } | ||