Fix lint issues

This commit is contained in:
Joel Elkins 2022-07-19 11:26:14 -05:00
parent 6ed4f11da3
commit d36f1ac0d5
6 changed files with 10 additions and 20 deletions

View File

@ -36,7 +36,7 @@ var createCmd = &cobra.Command{
ValidArgsFunction: validNouns, ValidArgsFunction: validNouns,
Long: `Create containers specified by the arguments. Arguments can be either container Long: `Create containers specified by the arguments. Arguments can be either container
names or categories. Multiple arguments are supported.`, names or categories. Multiple arguments are supported.`,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, args []string) error {
conts := config.Union(args) conts := config.Union(args)
for _, c := range conts { for _, c := range conts {
fmt.Fprintln(output, "CREATE", c.Name) fmt.Fprintln(output, "CREATE", c.Name)

View File

@ -26,7 +26,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
func validNouns(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { func validNouns(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) {
validArgs := []string{} validArgs := []string{}
for _, c := range config.Union([]string{}) { for _, c := range config.Union([]string{}) {
validArgs = append(validArgs, c.Name) validArgs = append(validArgs, c.Name)

View File

@ -30,13 +30,13 @@ import (
// recreateCmd represents the recreate command // recreateCmd represents the recreate command
var recreateCmd = &cobra.Command{ var recreateCmd = &cobra.Command{
Use: "recreate", Use: "recreate",
Short: "Recreate container images", Short: "Recreate container images",
Args: cobra.OnlyValidArgs, Args: cobra.OnlyValidArgs,
ValidArgsFunction: validNouns, ValidArgsFunction: validNouns,
Long: `Recreate container images, stopping and restarting if necessary. Arguments can be Long: `Recreate container images, stopping and restarting if necessary. Arguments can be
one or more container names or categories. If empty, "all" is assumed.`, one or more container names or categories. If empty, "all" is assumed.`,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, args []string) error {
conts := config.Union(args) conts := config.Union(args)
for _, c := range conts { for _, c := range conts {
fmt.Fprintln(output, "RECREATE", c.Name) fmt.Fprintln(output, "RECREATE", c.Name)

View File

@ -30,13 +30,13 @@ import (
// restartCmd represents the restart command // restartCmd represents the restart command
var restartCmd = &cobra.Command{ var restartCmd = &cobra.Command{
Use: "restart", Use: "restart",
Short: "Restart containers", Short: "Restart containers",
Args: cobra.OnlyValidArgs, Args: cobra.OnlyValidArgs,
ValidArgsFunction: validNouns, ValidArgsFunction: validNouns,
Long: `Stop configured containers (if running), then restart them. Arguments can be Long: `Stop configured containers (if running), then restart them. Arguments can be
one or more container names or categories. If empty, "all" is assumed.`, one or more container names or categories. If empty, "all" is assumed.`,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, args []string) error {
conts := config.Union(args) conts := config.Union(args)
for _, c := range conts { for _, c := range conts {
fmt.Fprintln(output, "RESTART", c.Name) fmt.Fprintln(output, "RESTART", c.Name)
@ -52,14 +52,4 @@ one or more container names or categories. If empty, "all" is assumed.`,
func init() { func init() {
rootCmd.AddCommand(restartCmd) rootCmd.AddCommand(restartCmd)
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// restartCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// restartCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
} }

View File

@ -36,7 +36,7 @@ var startCmd = &cobra.Command{
ValidArgsFunction: validNouns, ValidArgsFunction: validNouns,
Long: `Start configured containers. They must be created first. Arguments can be Long: `Start configured containers. They must be created first. Arguments can be
one or more container names or categories. If empty, "all" is assumed.`, one or more container names or categories. If empty, "all" is assumed.`,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, args []string) error {
conts := config.Union(args) conts := config.Union(args)
for _, c := range conts { for _, c := range conts {
fmt.Fprintln(output, "START", c.Name) fmt.Fprintln(output, "START", c.Name)

View File

@ -36,7 +36,7 @@ var updateCmd = &cobra.Command{
ValidArgsFunction: validNouns, ValidArgsFunction: validNouns,
Long: `Update container images, stopping and restarting if necessary. Arguments can be Long: `Update container images, stopping and restarting if necessary. Arguments can be
one or more container names or categories. If empty, "all" is assumed.`, one or more container names or categories. If empty, "all" is assumed.`,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, args []string) error {
conts := config.Union(args) conts := config.Union(args)
for _, c := range conts { for _, c := range conts {
fmt.Fprintln(output, "UPDATE", c.Name) fmt.Fprintln(output, "UPDATE", c.Name)