From 966a39c04431bb7ae2d23f7446a09a052d88d7a3 Mon Sep 17 00:00:00 2001 From: rsteube Date: Mon, 25 Sep 2023 16:55:17 +0200 Subject: [PATCH] tmp --- storage.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/storage.go b/storage.go index 082d986bf..3f022c193 100644 --- a/storage.go +++ b/storage.go @@ -79,7 +79,15 @@ func (s _storage) getFlag(cmd *cobra.Command, name string) Action { entry := s.get(cmd) entry.flagMutex.RLock() defer entry.flagMutex.RUnlock() - a := s.preinvoke(cmd, flag, entry.flag[name]) + + flagAction, ok := entry.flag[name] + if !ok { + if f, ok := cmd.GetFlagCompletionByName(name); ok { + flagAction = actionCobra(cmd, f) + } + } + + a := s.preinvoke(cmd, flag, flagAction) return ActionCallback(func(c Context) Action { // TODO verify order of execution is correct invoked := a.Invoke(c) @@ -116,6 +124,8 @@ func (s _storage) getPositional(cmd *cobra.Command, index int) Action { entry := s.get(cmd) isDash := common.IsDash(cmd) + // TODO fallback to cobra defined completion if exists + var a Action switch { case !isDash && len(entry.positional) > index: