1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

fix: test output for completions (#2597)

This commit is contained in:
Bartek Iwańczuk 2019-06-30 00:35:56 +02:00 committed by Ryan Dahl
parent 38cf346d5c
commit 5a4bebb770

View file

@ -8,6 +8,7 @@ use clap::SubCommand;
use crate::deno_dir; use crate::deno_dir;
use log::Level; use log::Level;
use std; use std;
use std::str;
use std::str::FromStr; use std::str::FromStr;
// Creates vector of strings, Vec<String> // Creates vector of strings, Vec<String>
@ -671,11 +672,13 @@ pub fn flags_from_vec(
} }
("completions", Some(completions_match)) => { ("completions", Some(completions_match)) => {
let shell: &str = completions_match.value_of("shell").unwrap(); let shell: &str = completions_match.value_of("shell").unwrap();
let mut buf: Vec<u8> = vec![];
create_cli_app().gen_completions_to( create_cli_app().gen_completions_to(
"deno", "deno",
Shell::from_str(shell).unwrap(), Shell::from_str(shell).unwrap(),
&mut std::io::stdout(), &mut buf,
); );
print!("{}", std::str::from_utf8(&buf).unwrap());
DenoSubcommand::Completions DenoSubcommand::Completions
} }
("eval", Some(eval_match)) => { ("eval", Some(eval_match)) => {