Skip to content

Commit

Permalink
fixes #45
Browse files Browse the repository at this point in the history
  • Loading branch information
jmccarthy committed Jun 8, 2018
1 parent 06b8a2f commit 44931ca
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/cli/procedure.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var procedureCommand = cli.Command{
Usage: "create ticket by procedure ID",
ArgsUsage: "procedureID",
Action: procedureAction,
Before: projectMustExist,
Before: beforeAll(projectMustExist, ticketingMustBeConfigured),
}

func procedureAction(c *cli.Context) error {
Expand Down
37 changes: 37 additions & 0 deletions internal/model/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ func GetPlugin(ts TicketSystem) TicketPlugin {
tsPluginsMu.Lock()
defer tsPluginsMu.Unlock()

if ts == NoTickets {
return &noopTicketSystem{}
}

tp, ok := tsPlugins[ts]
if !ok {
panic("Unknown ticket system: " + ts)
Expand Down Expand Up @@ -100,3 +104,36 @@ func Register(ts TicketSystem, plugin TicketPlugin) {

tsPlugins[ts] = plugin
}

type noopTicketSystem struct{}

func (*noopTicketSystem) Get(ID string) (*Ticket, error) {
return nil, nil
}
func (*noopTicketSystem) FindOpen() ([]*Ticket, error) {
return []*Ticket{}, nil
}
func (*noopTicketSystem) FindByTag(name, value string) ([]*Ticket, error) {
return []*Ticket{}, nil
}
func (*noopTicketSystem) FindByTagName(name string) ([]*Ticket, error) {
return []*Ticket{}, nil
}
func (*noopTicketSystem) Create(ticket *Ticket, labels []string) error {
return nil
}
func (*noopTicketSystem) Configure(map[string]interface{}) error {
return nil
}
func (*noopTicketSystem) Prompts() map[string]string {
return make(map[string]string)
}
func (*noopTicketSystem) Links() TicketLinks {
return TicketLinks{}
}
func (*noopTicketSystem) LinkFor(ticket *Ticket) string {
return ""
}
func (*noopTicketSystem) Configured() bool {
return false
}

0 comments on commit 44931ca

Please sign in to comment.