Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Sep 25, 2023
1 parent 2e08717 commit 966a39c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 966a39c

Please sign in to comment.