mirror of
https://github.com/harness/drone.git
synced 2025-05-02 05:30:13 +00:00
* initial config for ci linter * more linter work * linter errors fix * linter errors fix * linter conf minor changes
41 lines
884 B
Go
41 lines
884 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 users
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/harness/gitness/cli/util"
|
|
|
|
"gopkg.in/alecthomas/kingpin.v2"
|
|
)
|
|
|
|
type deleteCommand struct {
|
|
email string
|
|
}
|
|
|
|
func (c *deleteCommand) run(*kingpin.ParseContext) error {
|
|
client, err := util.Client()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
|
|
defer cancel()
|
|
return client.UserDelete(ctx, c.email)
|
|
}
|
|
|
|
// helper function registers the user delete command.
|
|
func registerDelete(app *kingpin.CmdClause) {
|
|
c := new(deleteCommand)
|
|
|
|
cmd := app.Command("delete", "delete a user").
|
|
Action(c.run)
|
|
|
|
cmd.Arg("id or email", "user id or email").
|
|
Required().
|
|
StringVar(&c.email)
|
|
}
|