Skip to content

Commit

Permalink
move main to cmd directory
Browse files Browse the repository at this point in the history
  • Loading branch information
mdb committed Nov 14, 2022
1 parent 32606ba commit 0ee4ce4
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 60 deletions.
1 change: 1 addition & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ builds:
- linux
- windows
- netbsd
main: ./cmd/main.go
archives:
- name_template: "{{ .Os }}-{{ .Arch }}"
format: binary
Expand Down
38 changes: 38 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package main

import (
"os"

"github.com/MakeNowJust/heredoc"
"github.com/mdb/gh-dispatch/dispatch"
"github.com/spf13/cobra"
)

// version's value is passed in at build time.
var version string

func main() {
rootCmd := &cobra.Command{
Use: "gh dispatch",
Short: "Send a GitHub dispatch event and watch the resulting GitHub Actions run",
Long: heredoc.Doc(`
Send a workflow_dispatch or repository_dispatch event and watch the resulting
GitHub Actions run.
`),
SilenceUsage: true,
Version: version,
}

// TODO: how to make this required?
rootCmd.PersistentFlags().StringP("repo", "R", "", "The targeted repository's full name (in 'owner/repo' format)")

repositoryCmd := dispatch.NewCmdRepository()
rootCmd.AddCommand(repositoryCmd)

workflowCmd := dispatch.NewCmdWorkflow()
rootCmd.AddCommand(workflowCmd)

if err := rootCmd.Execute(); err != nil {
os.Exit(1)
}
}
File renamed without changes.
8 changes: 0 additions & 8 deletions cmd/repository.go

This file was deleted.

32 changes: 0 additions & 32 deletions cmd/root.go

This file was deleted.

10 changes: 0 additions & 10 deletions cmd/workflow.go

This file was deleted.

10 changes: 0 additions & 10 deletions main.go

This file was deleted.

0 comments on commit 0ee4ce4

Please sign in to comment.