-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
abc1652
commit 36e2d23
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} |