removed name filtering prior to demo

This commit is contained in:
Steve Cliff
2026-03-02 12:06:07 +00:00
parent ead055a73a
commit 7452734e38
2 changed files with 1 additions and 56 deletions
-35
View File
@@ -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
+1 -21
View File
@@ -12,32 +12,14 @@ import (
var statusCmd = &cobra.Command{
Use: "status",
Short: "Show status summary of boards and their lists",
Long: "Displays a summary of boards, their lists, and the number of cards in each list.\nUse --project to filter by project name.",
Long: "Displays a summary of boards, their lists, and the number of cards in each list.",
RunE: func(cmd *cobra.Command, args []string) error {
projectName, _ := cmd.Flags().GetString("project")
// Get all boards
boards, err := getClient().ListBoards(getContext())
if err != nil {
return fmt.Errorf("failed to list boards: %w", err)
}
// Filter boards by project if --project flag is provided
if projectName != "" {
projectID, err := resolveProjectNameToID(projectName)
if err != nil {
return err
}
filtered := boards[:0]
for _, board := range boards {
if board.ProjectID == projectID {
filtered = append(filtered, board)
}
}
boards = filtered
}
// Build status summary with error collection
summary := model.StatusSummary{
TotalBoards: len(boards),
@@ -120,6 +102,4 @@ var statusCmd = &cobra.Command{
func init() {
rootCmd.AddCommand(statusCmd)
statusCmd.Flags().String("project", "", "Filter status by project name")
}