- Add .gitignore: exclude compiled binaries, build artifacts, and Helm values files containing real secrets (authentik, prometheus) - Add all Kubernetes deployment manifests (deployment/) - Add services source code: ha-sync, device-inventory, games-console, paperclip, parts-inventory - Add Ansible orchestration: playbooks, roles, inventory, cloud-init - Add hardware specs, execution plans, scripts, HOMELAB.md - Add skills/homelab/SKILL.md + skills/install.sh to preserve Copilot skill - Remove previously-tracked inventory-cli binary from git index Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
45 lines
929 B
Go
45 lines
929 B
Go
package cmd
|
|
|
|
import (
|
|
"bufio"
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var deleteCmd = &cobra.Command{
|
|
Use: "delete <id>",
|
|
Short: "Delete a part by ID",
|
|
Args: cobra.ExactArgs(1),
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
id := args[0]
|
|
yes, _ := cmd.Flags().GetBool("yes")
|
|
|
|
if !yes {
|
|
fmt.Printf("Delete part %s? [y/N]: ", id)
|
|
reader := bufio.NewReader(os.Stdin)
|
|
answer, err := reader.ReadString('\n')
|
|
if err != nil {
|
|
return fmt.Errorf("failed to read input: %w", err)
|
|
}
|
|
if !strings.EqualFold(strings.TrimSpace(answer), "y") {
|
|
fmt.Println("Aborted.")
|
|
return nil
|
|
}
|
|
}
|
|
|
|
if err := GetClient().DeletePart(id); err != nil {
|
|
return fmt.Errorf("failed to delete part: %w", err)
|
|
}
|
|
|
|
fmt.Printf("Deleted part %s\n", id)
|
|
return nil
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
deleteCmd.Flags().BoolP("yes", "y", false, "Skip confirmation prompt")
|
|
rootCmd.AddCommand(deleteCmd)
|
|
}
|