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
@@ -72,4 +72,12 @@ func init() {
entryCmd.Flags().StringVarP(&notes, "notes", "n", "", "Update activity notes")
entryCmd.Flags().StringVarP(&task, "task", "t", "", "Update activity task")
entryCmd.Flags().BoolVar(&fractional, "decimal", false, "Show fractional hours in decimal format instead of minutes")
flagName := "task"
entryCmd.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
})
}