Euphoria Ticket #727: An erroneous command line option shouldn't display all command line options

Invoke the translator or interpreter with a bad option. It will display 'bad option' and tell us which one. However, it also displays the help message. Let it be so it doesn't display this help message in this case.

Details

Type: Feature Request Severity: Minor Category: Front End
Assigned To: SDPringle Status: Fixed Reported Release:
Fixed in SVN #: View VCS: none Milestone: 4.0.4

1. Comment by SDPringle Nov 26, 2011

This is part of cmd_line(). Unfortunately, we use cmd_line() for parsing for the front end. We are rather locked into this behaivor unless we reimplement most of the guts of cmd_line() in the front end source or add an additional option to cmd_line().

2. Comment by jimcbrown Nov 26, 2011

I believe we should add an option to cmd_line().

Others may write simple command line utilities with Euphoria, and may want to use cmd_line() to parse the parameters, but also have it handle the help and bad options in a GNU-like way.

I see a huge benefit in adding support for this directly in cmd_line() itself.

3. Comment by SDPringle Nov 26, 2011

I would make this behavior a validation flag or rather the absence of one. SHOW_OPTIONS_ON_ERROR. Then if you supply this as a parse option then you get a list of all of the options, if not you don't. Now, parse_options could default to SHOW_OPTIONS_ON_ERROR.

4. Comment by DerekParnell Nov 26, 2011

The command line parser is trying to be helpful. It currently assumes that if you get any error in the parsing, you might wish to see what all your available options are.

So maybe we can adjust this behaviour to display all the options if either the HELP switch is used, or no mandatory switches were supplied, or an unrecognized switch was supplied.

In the case were it recognizes a switch but that switch has an error, we could just display the help for that particular switch.

In all other error cases, we could just display a generic message that suggests if the user wants more detail then use the HELP switch.

5. Comment by SDPringle Nov 26, 2011

In order to do this efficiently, we really have to break old behavior in the library routines. I don't believe this should go in a bug fix release. We should think about how we can modify cmd_parse() such that it can accommodate these these distinct behaviors. Marking for Milestone 4.1

6. Comment by SDPringle Nov 28, 2011

Well, the team has convinced me it isn't a big enough change to wait for 4.1. Remarking for 4.0.4.

7. Comment by SDPringle Nov 28, 2011

See: hg:euphoria/rev/1b2762f90ee2

changeset: 5288:1b2762f90ee2 branch: 4.0 tag: tip parent: 5286:5062bba3b0dc user: Shawn Pringle <shawn.pringle@gmail.com> date: Mon Nov 28 21:36:15 2011 -0300 files: include/std/cmdline.e source/intinit.e source/traninit.e description:

  • fixes ticket 727

8. Comment by SDPringle Dec 04, 2011

Not yet, if you don't include the EUPHORIA file to translate it still displays all of the options.

9. Comment by SDPringle Dec 04, 2011

See: hg:euphoria/rev/22fc4325c1e4

changeset: 5302:22fc4325c1e4 branch: 4.0 user: Shawn Pringle <shawn.pringle@gmail.com> date: Sun Dec 04 09:02:04 2011 -0300 files: source/intinit.e source/traninit.e description:

  • fixes ticket 727

Search



Quick Links

User menu

Not signed in.

Misc Menu