summaryrefslogtreecommitdiff
path: root/cli/flags.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2019-06-30 00:35:56 +0200
committerRyan Dahl <ry@tinyclouds.org>2019-06-29 18:35:56 -0400
commit5a4bebb77080d8a72a3faa594a388c6bce46e346 (patch)
tree2f8b4808c206079b2d4af7a878c036ab17f16b87 /cli/flags.rs
parent38cf346d5c0f69dfb0919781fb61db7a6597ded1 (diff)
fix: test output for completions (#2597)
Diffstat (limited to 'cli/flags.rs')
-rw-r--r--cli/flags.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/cli/flags.rs b/cli/flags.rs
index 5e15a1e75..4d68ac726 100644
--- a/cli/flags.rs
+++ b/cli/flags.rs
@@ -8,6 +8,7 @@ use clap::SubCommand;
use crate::deno_dir;
use log::Level;
use std;
+use std::str;
use std::str::FromStr;
// Creates vector of strings, Vec<String>
@@ -671,11 +672,13 @@ pub fn flags_from_vec(
}
("completions", Some(completions_match)) => {
let shell: &str = completions_match.value_of("shell").unwrap();
+ let mut buf: Vec<u8> = vec![];
create_cli_app().gen_completions_to(
"deno",
Shell::from_str(shell).unwrap(),
- &mut std::io::stdout(),
+ &mut buf,
);
+ print!("{}", std::str::from_utf8(&buf).unwrap());
DenoSubcommand::Completions
}
("eval", Some(eval_match)) => {