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:
+2
-5
@@ -573,7 +573,7 @@ func runCommandDepth(line string, depth int) bool {
|
||||
}
|
||||
}
|
||||
|
||||
case "open", "view": // open project in Xcode / editor
|
||||
case "view": // open a project in Xcode / the configured editor
|
||||
prj := PRJ
|
||||
if w := word(words, 1); w != "" {
|
||||
prj = w
|
||||
@@ -608,9 +608,6 @@ func runCommandDepth(line string, depth int) bool {
|
||||
}
|
||||
runInDir(d, editor, d)
|
||||
}
|
||||
if words[0] == "open" {
|
||||
PRJ = prj
|
||||
}
|
||||
|
||||
case "count": // count source lines in the project
|
||||
if !requireProject() {
|
||||
@@ -809,7 +806,7 @@ const gitignore = `.DS_Store
|
||||
|
||||
var helpItems = []struct{ cmd, desc string }{
|
||||
{"cd [project]", "change project (no argument: back to the base)"},
|
||||
{"open [project]", "open project"},
|
||||
{"view [project]", "open project in Xcode / the editor"},
|
||||
{"init", "make new repository from current directory"},
|
||||
{"push [comment]", "push changes to git server"},
|
||||
{"pushremote [@name] [desc]", "mirror repo to the public server(s) (gitea/github/gitlab)"},
|
||||
|
||||
Reference in New Issue
Block a user