loki icon indicating copy to clipboard operation
loki copied to clipboard

OptionParser requires passing the :switches or :strict option

Open jfpedroza opened this issue 5 years ago • 1 comments

OptionParser now requires passing the :switches or :strict option, otherwise it throws a warning everytime it's used. I would like to ask: What is the purpose of using OptionParser to parse the input from ask and the other functions from Loki.Shell?

This is what I get when I run the tests (in 6 of them):

...warning: not passing the :switches or :strict option to OptionParser is deprecated
  (elixir) lib/option_parser.ex:562: OptionParser.build_config/1
  (elixir) lib/option_parser.ex:197: OptionParser.parse/2
  test/loki/shell_test.exs:11: anonymous fn/0 in Loki.ShellTest."test Shell #ask input"/1
  (ex_unit) lib/ex_unit/capture_io.ex:150: ExUnit.CaptureIO.do_capture_io/2
  (ex_unit) lib/ex_unit/capture_io.ex:120: ExUnit.CaptureIO.do_capture_io/3
  test/loki/shell_test.exs:10: Loki.ShellTest."test Shell #ask input"/1
  (ex_unit) lib/ex_unit/runner.ex:312: ExUnit.Runner.exec_test/1
  (stdlib) timer.erl:166: :timer.tc/1
  (ex_unit) lib/ex_unit/runner.ex:251: anonymous fn/4 in ExUnit.Runner.spawn_test/3

jfpedroza avatar Nov 07 '18 05:11 jfpedroza

@johnf9896, Loki was developed as a tool that helps develop terminal friendly apps. So we have yes, no, aks methods. So ask method something like helper that you allow compound you methods for "asking custom questions". I think there are 2 ways for solve you problem:

  1. Remove
  2. Set default value with the possibility to pass you settings for options parser.

Could you write a code example or your case for this method?

khusnetdinov avatar Nov 07 '18 07:11 khusnetdinov