Skip to content
This repository has been archived by the owner on May 16, 2022. It is now read-only.

Commit

Permalink
Small cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
skolodyazhnyy committed Feb 6, 2020
1 parent 60783c9 commit 79de20f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
6 changes: 3 additions & 3 deletions cmd/go-starter-drone/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func usage() {
out := flag.CommandLine.Output()
_, _ = fmt.Fprintf(out, "go-starter-drone version %v (commit %v)\n", version, commit)
_, _ = fmt.Fprintf(out, "\n")
_, _ = fmt.Fprintf(out, "Usage: %s [flags] <drone-url> <github-org> <github-repo>\n", os.Args[0])
_, _ = fmt.Fprintf(out, "Usage: %s [flags] <drone-url> <org-name> <repo-name>\n", os.Args[0])
_, _ = fmt.Fprintf(out, "\nExample:\n")
_, _ = fmt.Fprintf(out, " %s https://cloud.drone.io adobe awesome-project\n", os.Args[0])
_, _ = fmt.Fprintf(out, "\nFlags:\n")
Expand Down Expand Up @@ -72,12 +72,12 @@ func main() {
org, repo := flag.Arg(1), flag.Arg(2)
if org == "" {
flag.Usage()
ui.Fatalf("GitHub organisation is empty\n")
ui.Fatalf("Organisation name is empty\n")
}

if repo == "" {
flag.Usage()
ui.Fatalf("GitHub repository name is empty\n")
ui.Fatalf("Repository name is empty\n")
}

// get credentials from OSX keychain
Expand Down
16 changes: 9 additions & 7 deletions cmd/go-starter-github/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ func usage() {
}

func main() {
var remote, deployKey string
var remote, branch, deployKey string
var public, issues, projects, wiki bool
var collaborators SliceFlag

flag.Usage = usage
flag.StringVar(&remote, "remote", "upstream", "Name of the remote in local repository")
flag.StringVar(&branch, "branch", "master", "Name of the master branch")
flag.BoolVar(&issues, "with-issues", false, "Enable issues in GitHub")
flag.BoolVar(&projects, "with-projects", false, "Enable projects in GitHub")
flag.BoolVar(&wiki, "with-wiki", false, "Enable wiki page in GitHub")
Expand Down Expand Up @@ -92,11 +93,12 @@ func main() {

// create repository
repo, _, err := cli.Repositories.Create(context.Background(), org, &github.Repository{
Name: github.String(name),
Private: github.Bool(!public),
HasIssues: github.Bool(issues),
HasProjects: github.Bool(projects),
HasWiki: github.Bool(wiki),
Name: github.String(name),
Private: github.Bool(!public),
HasIssues: github.Bool(issues),
HasProjects: github.Bool(projects),
HasWiki: github.Bool(wiki),
MasterBranch: github.String(branch),
})

if err != nil {
Expand Down Expand Up @@ -136,7 +138,7 @@ func main() {
}

// push to remote
if err := run("git", "push", "--set-upstream", "upstream", "master"); err != nil {
if err := run("git", "push", "--set-upstream", remote, branch); err != nil {
ui.Fatalf("An error occurred while running git push: %v\n", err)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/go-starter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func usage() {
_, _ = fmt.Fprintf(out, "\n")
_, _ = fmt.Fprintf(out, "Usage: %s [flags] <template> <destination>\n", os.Args[0])
_, _ = fmt.Fprintf(out, "\nExample:\n")
_, _ = fmt.Fprintf(out, " %s -var \"app_name=awesome-project\" skolodyazhnyy/go-starter-template awesome-project\n", os.Args[0])
_, _ = fmt.Fprintf(out, " %s -var \"app_name=awesome-project\" go-starter/awesome-starter awesome-project\n", os.Args[0])
_, _ = fmt.Fprintf(out, "\nFlags:\n")
flag.PrintDefaults()
_, _ = fmt.Fprintf(out, "\n")
Expand Down

0 comments on commit 79de20f

Please sign in to comment.