Skip to content

Commit

Permalink
add folderless-lists command
Browse files Browse the repository at this point in the history
  • Loading branch information
fantasticrabbit committed Nov 18, 2021
1 parent abc1652 commit 36e2d23
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions cmd/getlists_folderless.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package cmd

import (
"errors"
"strings"

"github.com/fantasticrabbit/ClickupCLI/internal"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)

var flessListsCmd = &cobra.Command{
Use: "folderless-lists SPACEID [-a]",
Short: "get data for lists in a workspace not in a folder",
Long: `Request JSON data for all folderless lists
by workspace ID`,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return errors.New("incorrect number of arguments")
}
return nil
},
PreRun: func(cmd *cobra.Command, args []string) {
checkToken()
},
Run: func(cmd *cobra.Command, args []string) {
viper.BindPFlag("archived", cmd.Flags().Lookup("archived"))
l := internal.ListRequest{
SpaceID: strings.Trim(args[0], " "),
Archived: viper.GetBool("archived"),
}
internal.Request(l)
},
}

func init() {
getCmd.AddCommand(flessListsCmd)
flessListsCmd.Flags().BoolP("archived", "a", false, "include archived lists in output")
}

0 comments on commit 36e2d23

Please sign in to comment.