DaemonEngine / crunch

Advanced DXTc texture compression and transcoding library and tool, upgraded with Unity improvements, added features, extended system and hardware support, deeply tested.
https://github.com/DaemonEngine/crunch
Other
16 stars 6 forks source link

crunch: add -h option to print help #34

Closed illwieckz closed 1 year ago

illwieckz commented 1 year ago

My routine to get help was:

$ crunch -h
Error: Unrecognized command line parameter: "-h"
Exit status: 1

$ crunch --help
Error: Unrecognized command line parameter: "--help"
Exit status: 1

$ crunch
Error: No command line parameters specified!

Command line usage:
[…]
Exit status: 1

Now I can do:

$ crunch -h
Command line usage:
[…]
Exit status: 0

Long options --help is also available, and /? is available on Windows as well.

illwieckz commented 1 year ago

This code may be written in other ways:

#if CRNLIB_CMD_LINE_ALLOW_SLASH_PARAMS
      if ((src_param == "/?") || (src_param == "--help"))
#else
      if (src_param == "--help")
#endif
      {

But this way is consistent with existing code right above:

#if CRNLIB_CMD_LINE_ALLOW_SLASH_PARAMS
    if ((src_param[0] == '/') || (src_param[0] == '-'))
#else
    if (src_param[0] == '-')
#endif
    {