diff --git a/README.md b/README.md index 9856eb6..4e2f6ce 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ stand in. Outside `base` no project is selected. `mgsh ` starts the interactive shell with that project preselected. The commands available directly from the shell are `clone`, `init`, `log`, -`push`, `pushremote`, `release`, `list`, `tag`, `archive`, `show`, `open`, +`push`, `pushremote`, `release`, `list`, `tag`, `archive`, `show`, `view`, `pull`, `fetch`, `status`, `diff`, `overview`, `config`, `count`, `login` and `cloneall`; every other command is interactive-only. @@ -52,7 +52,7 @@ project, its git branch and a `*` dirty marker: ``` Features: command history (`~/.mgsh_history`), Tab completion (commands, local -projects for `cd`/`open`, server repos for `clone`/`show`, branches/tags for +projects for `cd`/`view`, server repos for `clone`/`show`, branches/tags for `checkout`/`tag`, mirror targets for `pushremote`/`release`, filesystem paths for `dist`, and shell-style completion after `!` and for aliases that expand to one), and colored `list`/`log`/error output. @@ -106,6 +106,7 @@ Run `help` for the full list. Highlights: | command | description | |---------------------------|------------------------------------------------| | `cd [project]` | change project (no argument: back to the base) | +| `view [project]` | open a project in Xcode / the configured editor | | `push [comment]` | commit everything and push to the server | | `pushremote [desc]` | mirror the repo to a public server (gitea/github/gitlab) | | `pull` / `fetch` | pull / fetch from the server | @@ -409,7 +410,7 @@ gitpath = /home/git gitname = Your Name gitemail = you@example.com pushdefault = matching -editor = code # fallback opener for `open` +editor = code # fallback opener for `view` alias co 'checkout $1' ``` @@ -435,7 +436,7 @@ setting. | `gitname` | global | `user.name` written to the **global** git config at startup | | `gitemail` | global | `user.email` written to the global git config | | `pushdefault` | global | `push.default` written to the global git config | -| `editor` | project | opener used by `open`/`view` when the project has no Xcode workspace (default `coda`) | +| `editor` | project | opener used by `view` when the project has no Xcode workspace (default `coda`) | | `remote..url` | project | base URL of the mirror target `` | | `remote..key` | project | API token for that target | | `remote..type` | project | `gitea`\|`github`\|`gitlab`; auto-detected from the url when unset | diff --git a/alias.go b/alias.go index c258b36..d1c70c9 100644 --- a/alias.go +++ b/alias.go @@ -46,7 +46,7 @@ var builtinCmds = map[string]bool{ "diff": true, "pull": true, "fetch": true, "push": true, "edit": true, "pushremote": true, "overview": true, "archive": true, "init": true, "login": true, "cd": true, "checkout": true, "clone": true, "cloneall": true, - "open": true, "view": true, "count": true, "tag": true, "alias": true, + "view": true, "count": true, "tag": true, "alias": true, "unalias": true, "config": true, "release": true, } diff --git a/commands.go b/commands.go index 5a39c38..f810180 100644 --- a/commands.go +++ b/commands.go @@ -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)"}, diff --git a/completion.go b/completion.go index 55397ac..b3ff7da 100644 --- a/completion.go +++ b/completion.go @@ -45,14 +45,13 @@ func runeSuffixes(cands []string, prefix string) ([][]rune, int) { } // builtinCompleter is the command tree. Command names complete at the start of -// the line; cd/open/view complete local project names; clone/show complete +// the line; cd/view complete local project names; clone/show complete // repository names cached from the git server; checkout/tag complete branch and // tag names; pushremote/release complete mirror targets; dist completes // filesystem paths. func builtinCompleter() *readline.PrefixCompleter { return readline.NewPrefixCompleter( readline.PcItem("cd", readline.PcItemDynamic(dynLocalProjects)), - readline.PcItem("open", readline.PcItemDynamic(dynLocalProjects)), readline.PcItem("view", readline.PcItemDynamic(dynLocalProjects)), readline.PcItem("clone", readline.PcItem("-a", readline.PcItemDynamic(dynServerArchives)), diff --git a/config.go b/config.go index 8d1ee36..8485d84 100644 --- a/config.go +++ b/config.go @@ -33,7 +33,7 @@ type Config struct { GitName string // git user.name to set globally ("" = leave alone) GitEmail string // git user.email to set globally ("" = leave alone) PushDefault string // git push.default to set globally ("" = leave alone) - Editor string // editor/opener used as fallback by `open` ("" = coda) + Editor string // editor/opener used as fallback by `view` ("" = coda) Mirror string // truthy -> `push` also mirrors via `pushremote` SecretScan string // falsy -> `push` skips the credential scan Remotes []RemoteTarget diff --git a/main.go b/main.go index dd18c14..c82db2f 100644 --- a/main.go +++ b/main.go @@ -145,7 +145,7 @@ func parseArgs() (int, string, bool) { } cls := map[string]int{ "clone": 2, "init": 2, "log": 2, - "push": 1, "pushremote": 1, "list": 1, "tag": 1, "archive": 1, "show": 1, "open": 1, + "push": 1, "pushremote": 1, "list": 1, "tag": 1, "archive": 1, "show": 1, "view": 1, "pull": 1, "fetch": 1, "status": 1, "diff": 1, "overview": 1, "config": 1, "count": 1, "login": 1, "cloneall": 1, "release": 1, } diff --git a/shellcomplete_test.go b/shellcomplete_test.go index b71eced..f545d0d 100644 --- a/shellcomplete_test.go +++ b/shellcomplete_test.go @@ -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 diff --git a/version.txt b/version.txt index 6c1af82..088685f 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -4.0.46 +4.0.48