diff --git a/completions/just.elvish b/completions/just.elvish index 90f9b03..b1b128c 100644 --- a/completions/just.elvish +++ b/completions/just.elvish @@ -1,4 +1,3 @@ - edit:completion:arg-completer[just] = [@words]{ fn spaces [n]{ repeat $n ' ' | joins '' diff --git a/completions/just.powershell b/completions/just.powershell index ed79006..9f92c24 100644 --- a/completions/just.powershell +++ b/completions/just.powershell @@ -1,4 +1,3 @@ - using namespace System.Management.Automation using namespace System.Management.Automation.Language diff --git a/completions/just.zsh b/completions/just.zsh index 3f5aed2..4724fa8 100644 --- a/completions/just.zsh +++ b/completions/just.zsh @@ -60,4 +60,4 @@ _just_commands() { _describe -t commands 'just commands' commands "$@" } -_just "$@" \ No newline at end of file +_just "$@" diff --git a/src/common.rs b/src/common.rs index 33a2359..80201dd 100644 --- a/src/common.rs +++ b/src/common.rs @@ -6,7 +6,7 @@ pub(crate) use std::{ env, fmt::{self, Debug, Display, Formatter}, fs, - io::{self, Write}, + io::{self, Cursor, Write}, iter::{self, FromIterator}, ops::{Index, Range, RangeInclusive}, path::{Path, PathBuf}, diff --git a/src/config.rs b/src/config.rs index a413754..fdda02f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -464,7 +464,12 @@ impl Config { .parse::() .expect("Invalid value for clap::Shell"); - Self::app().gen_completions_to(env!("CARGO_PKG_NAME"), shell, &mut io::stdout()); + let buffer = Vec::new(); + let mut cursor = Cursor::new(buffer); + Self::app().gen_completions_to(env!("CARGO_PKG_NAME"), shell, &mut cursor); + let buffer = cursor.into_inner(); + let text = String::from_utf8(buffer).expect("Clap completion not UTF-8"); + println!("{}", text.trim()); Ok(()) }