From ead719cd027f46f096ae5e8df22d6cf0ee1108e0 Mon Sep 17 00:00:00 2001 From: Amolith Date: Sun, 21 Dec 2025 20:08:58 -0700 Subject: [PATCH] feat(completion): add positional arg completion Add ValidArgsFunction for positional KEY arguments: - area show: completes area keys - goal show: completes goal keys Assisted-by: Claude Opus 4 via Crush --- cmd/area/show.go | 6 ++++-- cmd/goal/show.go | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/area/show.go b/cmd/area/show.go index 538e17b9cdf9a47fb53c6d448535042c03b3e21e..b91c2c5f3950bc1e3facc1a9638261fbc26353b4 100644 --- a/cmd/area/show.go +++ b/cmd/area/show.go @@ -8,6 +8,7 @@ import ( "fmt" "git.secluded.site/lune/internal/client" + "git.secluded.site/lune/internal/completion" "git.secluded.site/lune/internal/config" "git.secluded.site/lune/internal/deeplink" "git.secluded.site/lune/internal/stats" @@ -22,8 +23,9 @@ var ShowCmd = &cobra.Command{ Long: `Show detailed information for a configured area. Displays the area's name, ID, deeplink, goals, and uncompleted task count.`, - Args: cobra.ExactArgs(1), - RunE: runShow, + Args: cobra.ExactArgs(1), + ValidArgsFunction: completion.Areas, + RunE: runShow, } func runShow(cmd *cobra.Command, args []string) error { diff --git a/cmd/goal/show.go b/cmd/goal/show.go index 95fa8af16709e9020c787c1ec1c336297fd7d559..10809aa78d8316122eb0b498acc505e1ee762e92 100644 --- a/cmd/goal/show.go +++ b/cmd/goal/show.go @@ -29,8 +29,9 @@ var ShowCmd = &cobra.Command{ If the goal key exists in multiple areas, use --area to disambiguate. Displays the goal's name, ID, deeplink, and uncompleted task count.`, - Args: cobra.ExactArgs(1), - RunE: runShow, + Args: cobra.ExactArgs(1), + ValidArgsFunction: completion.Goals, + RunE: runShow, } func init() {