diff options
| author | Jonas Maier <> | 2026-03-17 15:23:43 +0100 |
|---|---|---|
| committer | Jonas Maier <> | 2026-03-17 15:23:43 +0100 |
| commit | 965196972fa27237b6cb97209c915381a95a5bef (patch) | |
| tree | 225e1258bbd3ce961fc40390799666ffe51bbb9d /src/run/builtin.rs | |
| parent | 7b5a112d000bb21fd81569617353daa0c911d084 (diff) | |
| download | pish-965196972fa27237b6cb97209c915381a95a5bef.tar.gz | |
builtin to determine what completion would do
Diffstat (limited to 'src/run/builtin.rs')
| -rw-r--r-- | src/run/builtin.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/run/builtin.rs b/src/run/builtin.rs index 141357f..f0cb999 100644 --- a/src/run/builtin.rs +++ b/src/run/builtin.rs @@ -375,6 +375,33 @@ impl Builtin for parse { } } +pub struct completion; +impl Builtin for completion { + fn name(&self) -> &str { + "completion" + } + + fn io( + &self, + session: Arc<Mutex<Session>>, + args: &[BString], + _stdin: &mut dyn Read, + stdout: &mut dyn Write, + ) -> Result { + for arg in args { + let c = crate::completion(session.clone(), &arg); + write!(stdout, "{:?} ", c.kind)?; + stdout.write_all(&c.shared_prefix)?; + for s in c.suggestions { + stdout.write_all(b" ")?; + stdout.write_all(&s.display)?; + } + stdout.write_all(b"\n")?; + } + Ok(()) + } +} + pub struct null; impl Builtin for null { fn name(&self) -> &str { |
