removed name filtering prior to demo
This commit is contained in:
@@ -3,7 +3,6 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"git.franklin.lab/steve.cliff/pcli/client"
|
||||
"git.franklin.lab/steve.cliff/pcli/output"
|
||||
@@ -16,47 +15,15 @@ var boardCmd = &cobra.Command{
|
||||
Long: "Commands for managing Planka boards",
|
||||
}
|
||||
|
||||
func resolveProjectNameToID(projectName string) (string, error) {
|
||||
projects, err := getClient().ListProjects(getContext())
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
for _, project := range projects {
|
||||
if strings.EqualFold(project.Name, projectName) {
|
||||
return project.ID, nil
|
||||
}
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("project not found: %s", projectName)
|
||||
}
|
||||
|
||||
var boardListCmd = &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "List all accessible boards",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
projectName, _ := cmd.Flags().GetString("project")
|
||||
|
||||
boards, err := getClient().ListBoards(getContext())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if projectName != "" {
|
||||
projectID, err := resolveProjectNameToID(projectName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var filteredBoards []interface{}
|
||||
for _, board := range boards {
|
||||
if board.ProjectID == projectID {
|
||||
filteredBoards = append(filteredBoards, board)
|
||||
}
|
||||
}
|
||||
return output.Print(filteredBoards, getFormat(), os.Stdout)
|
||||
}
|
||||
|
||||
return output.Print(boards, getFormat(), os.Stdout)
|
||||
},
|
||||
}
|
||||
@@ -144,8 +111,6 @@ func init() {
|
||||
boardCmd.AddCommand(boardCreateCmd)
|
||||
boardCmd.AddCommand(boardDeleteCmd)
|
||||
|
||||
boardListCmd.Flags().String("project", "", "Filter boards by project name")
|
||||
|
||||
boardActionsCmd.Flags().Int("limit", 0, "Limit number of actions (0 = no limit)")
|
||||
|
||||
// Flags for board create
|
||||
|
||||
Reference in New Issue
Block a user