-
Notifications
You must be signed in to change notification settings - Fork 102
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
accept Array isn't working #219
Comments
With c.accept(Hash) do |value|
#puts "--- hash ---"
result = {}
value.split(/,/) do |pair|
k,v = pair.split(/:/)
result[k] = v
end
result
end
c.flag :siglas, :desc => "list of siglas", :type => Hash And the output: $ bundle exec bin/gliarray testarray --siglas="a:xxx,b:yyy"
error: unsupported argument type: Hash
$ bundle exec bin/gliarray testarray
error: unsupported argument type: Hash |
I think that accept(Hash) do |value|
#puts "--- hash ---"
result = {}
value.split(/,/) do |pair|
k,v = pair.split(/:/)
result[k] = v
end
result
end before any of your |
YES! That's it! I will update the wiki to add a note and the comment inside the code. The code was missing a accept(Hash) do |value|
puts "--- hash ---"
result = {}
value.split(/,/).each do |pair|
k,v = pair.split(/:/)
result[k] = v
end
result
end |
Fixed commented code, it needs a `.each` to work. closes davetron5000#219
@davetron5000 thanks for the replay. |
I'm trying to make a flag that accepts an array splits at dots (
.
).Then looking at examples I have written this command to test:
The problem happens when executing it:
As you can see it doesn't split as expected. I am doing something wrong?
I'm using gli version
2.13.1
.The text was updated successfully, but these errors were encountered: