feat: add --help guides to the .install and .uninstall REPL commands
.install --help and .uninstall --help print a usage guide covering the owner/repo shorthand, --git-host, --filter, --force, ref pinning, and the bundle lifecycle; both usage error lines now point at --help. Tab completion offers --help for both commands and --git-host on the first .install argument, and the unified install parser accepts flags in any argument position so completed flags work wherever they are inserted. The empty .list bundles message now shows the REPL install form alongside the CLI one.
This commit is contained in:
@@ -3278,10 +3278,19 @@ impl RequestContext {
|
||||
.map(|(name, desc)| (name, if desc.is_empty() { None } else { Some(desc) }))
|
||||
.collect(),
|
||||
".install" => {
|
||||
let mut values: Vec<String> =
|
||||
let mut names: Vec<String> =
|
||||
AssetCategory::NAMES.iter().map(|s| s.to_string()).collect();
|
||||
values.extend(installed_bundle_names());
|
||||
super::map_completion_values(values)
|
||||
names.extend(installed_bundle_names());
|
||||
let mut values = super::map_completion_values(names);
|
||||
values.push((
|
||||
"--git-host".to_string(),
|
||||
Some("Host the owner/repo shorthand expands against".to_string()),
|
||||
));
|
||||
values.push((
|
||||
"--help".to_string(),
|
||||
Some("Show usage for .install".to_string()),
|
||||
));
|
||||
values
|
||||
}
|
||||
".uninstall" => {
|
||||
let mut values = super::map_completion_values(installed_bundle_names());
|
||||
@@ -3289,6 +3298,10 @@ impl RequestContext {
|
||||
"--yes".to_string(),
|
||||
Some("Skip the uninstall confirmation".to_string()),
|
||||
));
|
||||
values.push((
|
||||
"--help".to_string(),
|
||||
Some("Show usage for .uninstall".to_string()),
|
||||
));
|
||||
|
||||
values
|
||||
}
|
||||
@@ -3525,6 +3538,9 @@ impl RequestContext {
|
||||
if !has_git_host {
|
||||
available.push("--git-host");
|
||||
}
|
||||
if !args.contains(&"--help") {
|
||||
available.push("--help");
|
||||
}
|
||||
|
||||
values = super::map_completion_values(available);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user