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

Flag value left blank results in printing help for main instead of command #234

Open
manther opened this issue Jan 21, 2016 · 3 comments
Open
Labels

Comments

@manther
Copy link

manther commented Jan 21, 2016

In the following example if you call the command "init -n" and don't pass a value for "-n" GLI prints the main help for the entire application instead of printing the help for the command that was being called "init"

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

program_desc 'Describe your application here'

version Testit::VERSION

subcommand_option_handling :normal
arguments :strict

command :init do |c|
  c.flag :n,
         :type     => String,
         :desc     => 'Name',
         :required => true
  c.action do |_, _, _|
    puts "test"
  end
end
@davetron5000
Copy link
Owner

Yup, looks like a bug :(

@manther
Copy link
Author

manther commented Jan 25, 2016

Thank you for looking into it.

@davetron5000
Copy link
Owner

See #326 as this is related. I believe this is OptionParser behavior which may be difficult to unwind or change. Leaving open as documentation

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

2 participants