Closed JakeLaCombe closed 3 years ago
What happens when you try to do this? i.e. if you give release_tasks
a flag
of default-version
, does that work?
when I run release_project --default_version=3.9.1, I get the following error
error: Unknown option --default_version
I did set the flag in the other commands as followed
command :release_documentation do |c_release_doc|
c_release_doc.desc 'dry run: print the release comment that would be posted in JIRA'
c_release_doc.flag [:dry]
c_release_doc.action do |globals, options, args|
if options[:dry]
puts 'Flag is set'
end
end
end
command :release_tasks do |c_release_tasks|
c_release_tasks.desc 'dry run: print the release comment that would be posted in JIRA'
c_release_tasks.flag [:dry]
c_release_tasks.action do |globals, options, args|
if options[:dry]
puts 'Flag is set'
end
end
end
OK, that's what I thought. How would you envisioning this worked? Would the compound command get all the flags and switches of its two commands? If so, how do we resolve duplicates?
(I'm guessing those questions are why I haven't implemented this yet :)
Would the compound command get all the flags and switches of its two commands?
I would have to say yes for this instance. If a developer is running a bundled command, I believe it can be assumed that they would like consistent behavior across the various commands, meaning all commands would have the same starting state and values.
If so, how do we resolve duplicates?
Are you referring to the case I have above, where dry is found in both of the commands? I feel for a case like that, then we would want to maintain the same values for those flags.
What about a case like this:
command :release_documentation do |c_release_doc|
c_release_doc.desc 'dry run: print the release comment that would be posted in JIRA'
c_release_doc.flag [:dry, :'dry-run'] # <----
c_release_doc.action do |globals, options, args|
if options[:dry]
puts 'Flag is set'
end
end
end
command :release_tasks do |c_release_tasks|
c_release_tasks.desc 'Do not repeat any tasks'
c_release_tasks.flag [:dry, :d] # <--
c_release_tasks.action do |globals, options, args|
if options[:dry]
puts 'Flag is set'
end
end
end
Would the assumption be that the developer knows not to do this?
I will agree that when you get to this route, that assumptions will get more difficult. I'lll see if I can get other developers' opinions on this topic as well.
Closing as old. Please re-open if you still need this.
Let's say I have a command like the following
I would like to ability to run the command as followed
However, I don't see a good way of being able to do this. Is GLI capable of passing flags to compound commands? If so, could we get a pull request to document how that would be done?