This commit is contained in:
kfcampbell 2020-03-20 15:11:47 -07:00
Родитель 2cff4c2adc
Коммит 9c9a489b31
4 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -11,6 +11,7 @@ import (
"github.com/github/hub/ui"
)
// Cmd is a project-wide struct that represents a command to be run in the console.
type Cmd struct {
Name string
Args []string
@ -64,9 +65,8 @@ func (cmd *Cmd) Success() bool {
func (cmd *Cmd) Run() error {
if isWindows() {
return cmd.Spawn()
} else {
return cmd.Exec()
}
return cmd.Exec()
}
func isWindows() bool {

Просмотреть файл

@ -16,7 +16,7 @@ import (
"github.com/github/hub/utils"
)
var cmdApi = &Command{
var cmdAPI = &Command{
Run: apiCommand,
Usage: "api [-it] [-X <METHOD>] [-H <HEADER>] [--cache <TTL>] <ENDPOINT> [-F <FIELD>|--input <FILE>]",
Long: `Low-level GitHub API request interface.
@ -97,7 +97,7 @@ var cmdApi = &Command{
<ENDPOINT>
The GitHub API endpoint to send the HTTP request to (default: "/").
To learn about available endpoints, see <https://developer.github.com/v3/>.
To make GraphQL queries, use "graphql" as <ENDPOINT> and pass ''-F query=QUERY''.
@ -143,7 +143,7 @@ hub(1)
}
func init() {
CmdRunner.Use(cmdApi)
CmdRunner.Use(cmdAPI)
}
func apiCommand(_ *Command, args *Args) {

Просмотреть файл

@ -20,7 +20,7 @@ var cmdBrowse = &Command{
-c, --copy
Put the URL in clipboard instead of opening it.
[<USER>/]<REPOSITORY>
Defaults to repository in the current working directory.
@ -118,12 +118,12 @@ func browse(command *Command, args *Args) {
path = subpage
}
pageUrl := project.WebURL("", "", path)
pageURL := project.WebURL("", "", path)
args.NoForward()
flagBrowseURLPrint := args.Flag.Bool("--url")
flagBrowseURLCopy := args.Flag.Bool("--copy")
printBrowseOrCopy(args, pageUrl, !flagBrowseURLPrint && !flagBrowseURLCopy, flagBrowseURLCopy)
printBrowseOrCopy(args, pageURL, !flagBrowseURLPrint && !flagBrowseURLCopy, flagBrowseURLCopy)
}
func branchInURL(branch *github.Branch) string {

Просмотреть файл

@ -57,11 +57,11 @@ func transformCherryPickArgs(args *Args) {
sha = matches[1]
project = url.Project
} else if matches := pullRegex.FindStringSubmatch(projectPath); len(matches) > 0 {
pullId := matches[1]
pullID := matches[1]
sha = matches[2]
utils.Check(mainProjectErr)
project = mainProject
refspec = fmt.Sprintf("refs/pull/%s/head", pullId)
refspec = fmt.Sprintf("refs/pull/%s/head", pullID)
}
} else {
ownerWithShaRegexp := regexp.MustCompile(fmt.Sprintf("^(%s)@(%s)$", OwnerRe, shaRe))