Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context.IsSet returns false even if StringSlice flag is set #314

Closed
disktnk opened this issue Dec 24, 2015 · 6 comments
Closed

Context.IsSet returns false even if StringSlice flag is set #314

disktnk opened this issue Dec 24, 2015 · 6 comments
Assignees
Labels
kind/bug describes or fixes a bug

Comments

@disktnk
Copy link

disktnk commented Dec 24, 2015

On my environment (mac OS X 10.10.5), Context.IsSet does not work when using StringSliceFlag .

// `cmd` is a "sub_command" object
cmd.Flags = []cli.Flag{
    cli.StringFlag{
        Name:   "string_arg, s",
        Value:  "",
        Usage:  "snip",
    },
    cli.StringSliceFlag{
        Name:  "string_slice_arg, a",
        Value: &cli.StringSlice{},
        Usage: "snip",
    },
}

// ...snip

fmt.Println(c.IsSet("string_arg"))
fmt.Println(c.IsSet("string_slice_arg"))
./go_binary sub_command -s str1 -a str2
true
false
@meatballhat meatballhat added the kind/bug describes or fixes a bug label Apr 29, 2016
@meatballhat meatballhat self-assigned this Apr 29, 2016
@meatballhat
Copy link
Member

Confirmed! Oddly, I'm seeing different behavior when calling IsSet with "short" vs "long" flag names (see gist). Still investigating...

@jszwedko
Copy link
Contributor

Hmmm, interesting, seems to have been introduced in #73

@meatballhat
Copy link
Member

Yeppers. My initial attempt to solve this is made more awkward by the slice types being aliases rather than composites. It might be easiest to address this after the merge of #350.

@meatballhat
Copy link
Member

I'm going to see if I can tack this bugfix onto #350 yep yep.

@codegangsta codegangsta added the status/claimed someone has claimed this issue label May 5, 2016
@jszwedko
Copy link
Contributor

Fixed by #392 (will be released is v2, but you can use that branch for now if you need the functionality sooner!).

@codegangsta codegangsta removed the status/claimed someone has claimed this issue label May 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug describes or fixes a bug
Projects
None yet
Development

No branches or pull requests

4 participants