Moving Task listing from ListCmd to Task and Adding Shell Completion for Task

This commit is contained in:
Martin (Schretzi) Fuchsluger
2025-02-14 22:44:33 +01:00
parent d5c41a921a
commit fa86b0f64f
6 changed files with 112 additions and 52 deletions
+8
View File
@@ -105,4 +105,12 @@ func init() {
finishCmd.Flags().StringVarP(&project, "project", "p", "", "Project to be assigned")
finishCmd.Flags().StringVarP(&notes, "notes", "n", "", "Activity notes")
finishCmd.Flags().StringVarP(&task, "task", "t", "", "Task to be assigned")
flagName := "task"
finishCmd.RegisterFlagCompletionFunc(flagName, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
user := GetCurrentUser()
entries, _ := database.ListEntries(user)
_, tasks := listProjectsAndTasks(entries)
return tasks, cobra.ShellCompDirectiveDefault
})
}