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
restructuring of main.rb breaks other uses of optparse #1562
Comments
Can you provide a minimal example with your Gemfile.lock? |
Also the regression around optparse was fixed in #1559, have you tried v2.0.7? |
Thanks, am on 2.0.7. The following would have worked in 2.0.6 but does not now with 2.0.7:
If you execute such a script with sinatra required, main.rb swallows all the params. |
Well, I have tried the above code in v2.0.5, v2.0.6 and v2.0.7. But I could't find any difference. |
Btw, please don't expect v2.0.6 to be correct. |
Yes, you are correct. My apologies. However, passing -h or --help with such a script prints the help from sinatra's main.rb and not the params and their descriptions in the script. Do you see the same? |
@dshorthouse Yes, I can see the same thing, it's expected originally. You can see the same even if using v2.0.5, right? This question is for making sure that your issue is not a regression. If you wouldn't like to use sinatra as a CLI tool, or would like to overwrite option parameters, you should use |
Thanks for this. Indeed, same if using v2.0.5 I see now. My issue is that I'd very much like to |
At first, I'm completely not sure that your app's definition and its context. So I can say something only about sinatra. In my understand, perhaps you'd like to use Sinatra::Contrib in both CLI and webapp, right? Probably you should be able to handle sinatra from the CLI as follows: # foo.yml
foo: bar
something: 42
nested:
a: 1
b: 2 require 'sinatra/base'
require 'sinatra/config_file'
class Foo < Sinatra::Base
register Sinatra::ConfigFile
config_file "./foo.yml"
p something # 42
end |
OK, thanks for the feedback. Guess I'll just have to restructure what I have as there's no longer a solution. Perhaps there's another gem out there that can do something comparable to |
Because main.rb has been restructured, it breaks use of optparse elsewhere in my app. I have an environment file in which I require the sinatra gem because I make use of sinatra/config_file. I also have some optparse-based scripts executed on the command line that also require sinatra and sinatra/config_file.
The text was updated successfully, but these errors were encountered: