Remove the open command
`open` and `view` shared one implementation and differed in a single line: `open` also made the project the active one. Only `view` is left, with the behaviour it always had. Dropping it from builtinCmds is the part worth noting: a reserved word cannot be shadowed by an alias, so `open` is now free for one -- `alias open '!xdg-open $1'` works, which it could not before. That also made a completion test wrong, since it used `open` as its example of a name a builtin owns; it uses `status` now. The `runInDir(d, "open", ...)` calls stay: those are macOS's open(1), which is how an Xcode workspace gets opened. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -214,10 +214,10 @@ func TestShellCandidatesThroughAlias(t *testing.T) {
|
||||
shellTree(t)
|
||||
fakeCommands(t, "vi", "ls")
|
||||
withAliases(t, map[string]string{
|
||||
"ll": "!ls -la",
|
||||
"e": "!vi $1",
|
||||
"co": "checkout $1", // a builtin, not a shell command
|
||||
"open": "!xdg-open $1", // shadows a builtin: must not count
|
||||
"ll": "!ls -la",
|
||||
"e": "!vi $1",
|
||||
"co": "checkout $1", // expands to a builtin, not a shell command
|
||||
"status": "!git status", // shadows a builtin: must not count
|
||||
})
|
||||
|
||||
// arguments of a shell alias complete against the filesystem
|
||||
@@ -246,7 +246,7 @@ func TestShellCandidatesThroughAlias(t *testing.T) {
|
||||
t.Error("an alias expanding to a builtin was treated as a shell line")
|
||||
}
|
||||
// nor is a name that a builtin owns, since runCommand never expands those
|
||||
if _, _, ok := shellLine("open ma"); ok {
|
||||
if _, _, ok := shellLine("status ma"); ok {
|
||||
t.Error("a builtin name was resolved through an alias")
|
||||
}
|
||||
// nor an undefined name
|
||||
|
||||
Reference in New Issue
Block a user