feat: expand owner/repo shorthand for --install with a --git-host flag
--install someuser/repo expands to https://github.com/someuser/repo; --git-host overrides the default host and forces source interpretation even when the value matches an installed bundle name. Two or more path segments are accepted so nested GitLab-style groups work, and #ref pinning applies to shorthand values. --uninstall resolves owner/repo against recorded sources: a single match uninstalls, multiple matches prompt an interactive selection showing each bundle's source, and non-interactive runs bail instead of guessing.
This commit is contained in:
@@ -187,6 +187,14 @@ pub struct Cli {
|
||||
help_heading = "Installation & Updates"
|
||||
)]
|
||||
pub install: Option<String>,
|
||||
/// Git host used to expand <owner>/<repo> shorthand values passed to --install
|
||||
#[arg(
|
||||
long,
|
||||
value_name = "HOST",
|
||||
requires = "install",
|
||||
help_heading = "Installation & Updates"
|
||||
)]
|
||||
pub git_host: Option<String>,
|
||||
/// Reinstall bundled assets, overwriting any local changes
|
||||
#[arg(
|
||||
long,
|
||||
@@ -593,6 +601,17 @@ mod tests {
|
||||
assert!(parse(&["--install", "https://github.com/x/y", "--install-force"]).install_force);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_git_host_requires_install() {
|
||||
assert!(Cli::try_parse_from(["coyote", "--git-host", "git.x.com"]).is_err());
|
||||
assert_eq!(
|
||||
parse(&["--install", "someuser/omc", "--git-host", "git.x.com"])
|
||||
.git_host
|
||||
.as_deref(),
|
||||
Some("git.x.com")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn help_omits_install_from_and_shows_install_builtins() {
|
||||
use clap::CommandFactory;
|
||||
|
||||
Reference in New Issue
Block a user