提交 3ab153ab 编写于 作者: M Mislav Marohnić

[create] Simplify checking for invalid first argument

上级 7ea9a151
......@@ -2,7 +2,6 @@ package commands
import (
"fmt"
"regexp"
"strings"
"github.com/github/hub/git"
......@@ -71,12 +70,10 @@ func create(command *Command, args *Args) {
utils.Check(err)
newRepoName = github.SanitizeProjectName(dirName)
} else {
reg := regexp.MustCompile("^[^-]")
if !reg.MatchString(args.FirstParam()) {
err = fmt.Errorf("invalid argument: %s", args.FirstParam())
utils.Check(err)
}
newRepoName = args.FirstParam()
if newRepoName == "" {
utils.Check(command.UsageError(""))
}
}
config := github.CurrentConfig()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册