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

Change error message when no files and no options provided to suggest --help option #6

Closed
delphidabbler opened this issue Jul 20, 2014 · 1 comment

Comments

@delphidabbler
Copy link
Collaborator

delphidabbler commented Jul 20, 2014

At present when CompFileDate is run with no parameters

Error: Exactly two file names must be specified

This isn't very helpful. It would be better if the program output either the complete or abbreviated help screen, such as

CompFileDate by DelphiDabbler (www.delphidabbler.com)
-----------------------------------------------------
Usage: CompFileDate filename1 filename2 [options]
  or   CompFileDate -h | -? | --help
  or   CompFileDate -V | --version

For further help use CompFileDate --help
@delphidabbler delphidabbler changed the title Changed error message when no files and no options provided to suggest --help option Change error message when no files and no options provided to suggest --help option Jul 20, 2014
@delphidabbler delphidabbler self-assigned this Sep 29, 2021
@delphidabbler
Copy link
Collaborator Author

delphidabbler commented Sep 29, 2021

Implementation ideas:

  1. Add new TParams.ShortHelp Boolean property.
  2. Change TParams.Parse at lines 140/141 to set ShortHelp property to True if both file names are empty instead of raising exception.
  3. In TMain.Execute about lines 218/219 to check if TParams.ShortHelp is True and call a new TMain.ShowShortHelp method to display required message.
  4. Implement TMain.ShowShortHelp to display sUsage followed by new resource string for rest of the message, i.e.: 'For further help use CompFileDate --help'
  5. Remove error code & message previously used when no file name provided, i.e.: cAppErrFileNamesSame and sAppErrFileNamesSame.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant