Calling hub with one or more options but no subcommand resulted in the
following error message trying to expand an empty string as an alias:
error: key does not contain variable name: alias.
This fixes the root cause: attempting to retrieve an invalid config key.
- Use bytes.Equal instead of bytes.Compare
- Use time.Since instead of manual timestamp subtracting
- Use sort.Strings instead of sort.StringSlice
- No need to specify the len of the slice
We might bring back the self-updater at some point, but right now it's
dead code and it's not clear to me how to implement it in a fashion
where it also updates dependent files such as shell completion scripts
and man pages.
The old `args.After("echo", ...)` approach won't cut it on Windows since
there is no `echo` executable. Thus, nothing was printed on Windows.
Instead, expand Args type with extra functionality that allows Go
callbacks after all commands in the chain have been run.
Also, the new `args.NoForward()` is now preferred to `os.Exit()` since
it's more descriptive and allows `defer` in the calling function.
If shelling out to nonexistent command, such as `echo` on Windows, print
the error on stderr instead of failing silently. This is also helpful
when hub tries to forward a command to `git`, but git is not installed.
Instead of displaying plain text help, `hub help <command>` will now
search for man pages to display.
* If `man` is available, hub first tries to locate the local
`../man/hub-<command>.1` file relative to the `hub` executable. If
found, open it with `man`. If not, execute `man 1 hub-<command>`.
* Otherwise, resort to displaying plain text help.
Before, the argument parser would translate `--help` and `--version` to
their equivalents without the dashes. Now it's not the parser's
responsibility to do that anymore. Instead, wire them up as subcommand
aliases in the runner.
Introduce a `console` package which encapsulates logic of printing out
to console. This provides flexibility of discarding output in tests.
It also allows us to unify format of printing to console (if we want to).
This fixes#801.
The changes in 0ed14758b7 mess up `go test`’s exit code since it executes test commands with exec(3) - `go test` always return 0. We need to stop shelling out commands in tests.