mirror of https://github.com/harness/drone.git
36 lines
775 B
Go
36 lines
775 B
Go
// Copyright 2021 Harness Inc. All rights reserved.
|
|
// Use of this source code is governed by the Polyform Free Trial License
|
|
// that can be found in the LICENSE.md file for this repository.
|
|
|
|
package pipeline
|
|
|
|
import (
|
|
"github.com/bradrydzewski/my-app/cli/util"
|
|
|
|
"gopkg.in/alecthomas/kingpin.v2"
|
|
)
|
|
|
|
type deleteCommand struct {
|
|
slug string
|
|
}
|
|
|
|
func (c *deleteCommand) run(*kingpin.ParseContext) error {
|
|
client, err := util.Client()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return client.PipelineDelete(c.slug)
|
|
}
|
|
|
|
// helper function registers the user delete command
|
|
func registerDelete(app *kingpin.CmdClause) {
|
|
c := new(deleteCommand)
|
|
|
|
cmd := app.Command("delete", "delete a pipeline").
|
|
Action(c.run)
|
|
|
|
cmd.Arg("slug ", "pipeline slug").
|
|
Required().
|
|
StringVar(&c.slug)
|
|
}
|