cobra icon indicating copy to clipboard operation
cobra copied to clipboard

Share more code between Traverse and stripFlags

Open dnephin opened this issue 7 years ago • 5 comments

Includes, and closes #616

dnephin avatar Jan 17 '18 18:01 dnephin

Pls ignore my previous comment.

On Thursday, 18 January 2018, Daniel Nephin [email protected] wrote:

@dnephin commented on this pull request.

In command.go https://github.com/spf13/cobra/pull/617#discussion_r162207585:

@@ -491,6 +468,30 @@ Loop: return commands }

+func hasDefaultValue(name string, fs *flag.FlagSet) bool {

  • flag := fs.Lookup(name)
  • if flag == nil {
  • return false
    
  • }
  • return flag.NoOptDefVal != "" +}

+func isShortFlagWithNoDefaultValue(arg string, flags *flag.FlagSet) bool {

If you would rather I omit the refactoring, and only add the test case for now, I'm fine with that.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/spf13/cobra/pull/617#discussion_r162207585, or mute the thread https://github.com/notifications/unsubscribe-auth/AAu9Mr3Hg0mkEw4wXE27zq41D-4-DXHmks5tLn5SgaJpZM4Rhztc .

millergarym avatar Jan 18 '18 23:01 millergarym

@dnephin looks like this needs a rebase 😅

thaJeztah avatar May 18 '18 23:05 thaJeztah

@dnephin @eparis This looks worth merging. Any interest in updating it to work with tip?

spf13 avatar Jun 07 '19 13:06 spf13

This PR is being marked as stale due to a long period of inactivity

github-actions[bot] avatar Apr 12 '20 00:04 github-actions[bot]

+label:needs investigation

It seems that this PR is worth merging in. It has a test and seems the work needed to be done here is just fixing conflicts. @dnephin Any interest in fixing the conflict? We can try and merge it in soon after if still applicable. WDYT?

wfernandes avatar Apr 19 '20 17:04 wfernandes