commands.go

 1// Package commands contains the assorted sub commands supported by the git-bug tool.
 2package commands
 3
 4import (
 5	"github.com/MichaelMure/git-bug/repository"
 6)
 7
 8const bugsRefPattern = "refs/bugs/*"
 9
10// Command represents the definition of a single command.
11type Command struct {
12	Usage     func(string)
13	RunMethod func(repository.Repo, []string) error
14}
15
16// Run executes a command, given its arguments.
17//
18// The args parameter is all of the command line args that followed the
19// subcommand.
20func (cmd *Command) Run(repo repository.Repo, args []string) error {
21	return cmd.RunMethod(repo, args)
22}
23
24// CommandMap defines all of the available (sub)commands.
25var CommandMap = map[string]*Command{
26	"pull": pullCmd,
27	"push": pushCmd,
28
29	/*"abandon": abandonCmd,
30	"accept":  acceptCmd,
31	"comment": commentCmd,
32	"list":    listCmd,
33	"pull":    pullCmd,
34	"push":    pushCmd,
35	"rebase":  rebaseCmd,
36	"reject":  rejectCmd,
37	"request": requestCmd,
38	"show":    showCmd,
39	"submit":  submitCmd,*/
40}