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

store flag value twice in command file #64

Closed
danielb2 opened this issue Dec 10, 2011 · 3 comments
Closed

store flag value twice in command file #64

danielb2 opened this issue Dec 10, 2011 · 3 comments
Labels
Milestone

Comments

@danielb2
Copy link

using version 1.4

if I run progname initconfig the value for flag :value is stored twice

#!/usr/bin/env ruby
require 'gli'
include GLI

config_file '/tmp/cfg.yml'

desc 'specify a value to use.'
default_value 'value shows in cfg file twice'
flag [:v,:value]
arg_name 'value'

desc 'command to show default values dont store for command flags'
command :command do |c|
  c.desc 'command value'
  c.default_value 'will not store in cfg'
  c.flag [:o,:other]
end
exit run(ARGV)

show help output that default value is set correctly

show it being stored twice in cfg file. once for :v: and once for :value:

 cat /tmp/cfg.yml 
--- 
:v: value shows in cfg file twice
:value: value shows in cfg file twice
commands: 
  :command: {}
@davetron5000
Copy link
Owner

Yeah, this is somewhat annoying and could create problems. I think the expected behavior would be to use the long-form option if one is there.

@vStone
Copy link

vStone commented Jun 18, 2013

which one would be selected for

flag [:u, :use_underscore, :'use-underscore'] ?

maybe adding something like flag_aliases could be useful.

@davetron5000
Copy link
Owner

Consolidated into #305

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants