Skip to content

Commit

Permalink
init offboard command
Browse files Browse the repository at this point in the history
  • Loading branch information
zeucapua committed Sep 24, 2024
1 parent 19ed450 commit 8d36d18
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
37 changes: 37 additions & 0 deletions cmd/offboard/offboard.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package offboard

import (
"fmt"

Check failure on line 4 in cmd/offboard/offboard.go

View workflow job for this annotation

GitHub Actions / lint

"fmt" imported and not used (typecheck)

Check failure on line 4 in cmd/offboard/offboard.go

View workflow job for this annotation

GitHub Actions / lint

"fmt" imported and not used) (typecheck)

Check failure on line 4 in cmd/offboard/offboard.go

View workflow job for this annotation

GitHub Actions / build

"fmt" imported and not used

Check failure on line 4 in cmd/offboard/offboard.go

View workflow job for this annotation

GitHub Actions / test

"fmt" imported and not used
"errors"

"github.com/spf13/cobra"
)

type Options struct {
offboardingUsers []string
}

const configLongDesc string = `[WIP] Removes a user from the \".sauced.yaml\" config and \"CODEOWNERS\" files.
Requires the user's name OR email.`

func NewConfigCommand() *cobra.Command {
options := &Options{}
cmd := &cobra.Command{
Use: "offboard <username/email> [flags]",
Short: "[WIP] Removes a user from the \".sauced.yaml\" config and \"CODEOWNERS\" files.",
Long: configLongDesc,
Args: func(_ *cobra.Command, args []string) error {
if !(len(args) > 0) {
errors.New("you must provide at least one argument: the offboarding user's email/username")
}

options.offboardingUsers = args

return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
return nil
},
}
return cmd
}
2 changes: 2 additions & 0 deletions cmd/root/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/open-sauced/pizza-cli/v2/cmd/docs"
"github.com/open-sauced/pizza-cli/v2/cmd/generate"
"github.com/open-sauced/pizza-cli/v2/cmd/insights"
"github.com/open-sauced/pizza-cli/v2/cmd/offboard"

Check failure on line 13 in cmd/root/root.go

View workflow job for this annotation

GitHub Actions / lint

could not import github.com/open-sauced/pizza-cli/v2/cmd/offboard (-: # github.com/open-sauced/pizza-cli/v2/cmd/offboard
"github.com/open-sauced/pizza-cli/v2/cmd/version"
"github.com/open-sauced/pizza-cli/v2/pkg/constants"
)
Expand Down Expand Up @@ -44,6 +45,7 @@ func NewRootCommand() (*cobra.Command, error) {
cmd.AddCommand(generate.NewGenerateCommand())
cmd.AddCommand(insights.NewInsightsCommand())
cmd.AddCommand(version.NewVersionCommand())
cmd.AddCommand(offboard.NewConfigCommand())

// The docs command is hidden as it's only used by the pizza-cli maintainers
docsCmd := docs.NewDocsCommand()
Expand Down

0 comments on commit 8d36d18

Please sign in to comment.