Makopo/lslint

version & command line usage inconsistencies

Closed this issue · 6 comments

  • running lslint fails (without target path or any other args)
    • printing help would be nice
  • running lslint --help fails
    • printing help would be nice
  • running lslint --version gives me the help, but not any version info
  • running lslint -V gives me version info, but fills my screen with "Hello Kitty"
    • version doesn't match release
      • The binaries from the v1.0.4 release still print out the version 0.4.3-xh.

Addressing the last point, I'd like to propose the following change, not sure if the syntax is correct:

--- lslmini.cc
+++ lslmini.cc
@@ -854,854 +854,8 @@
       fprintf(stderr, "by using this program you agree to smile :o)\n");
       */
 
-   fprintf(stderr, "     lcllok         ;....;   ccc:\n");
-   fprintf(stderr, "    ,dNWX0xolodddd:.','''..:OXWWX::\n");
-   fprintf(stderr, "   ::WMMMMMMMMMMMN;.,'.....':xkxx:,       =] W-Hat KReW PreZentZ [=\n");
-   fprintf(stderr, "   :,0WMMMMMMMMMMN;','...',,'...'..\n");
-   fprintf(stderr, "    .cNMMMMMMMMMMMK:,,;;.',,'...,,',            lslint v %s\n", VERSION);
-   fprintf(stderr, "   ,dWMMMMMMMMMMMMMMWWWMKdl,...''..\n");
-   fprintf(stderr, "  ,lWMMMMMMMMMMMMMMMMMMMMMMNo,'':o                 CODiNG::\n");
-   fprintf(stderr, "  .OMMMMMMMMMMMMMMMMMMMMMMMMMNXNMMx.                              ~masa~\n");
-   fprintf(stderr, ",:.cxKMMWkxNMMMMMMMMMMMMMMXKWMMMKxc.,,                      Doran Zemlja\n");
-   fprintf(stderr, "  ;c0XMMN;'OMMMMMWNWMMMMMX,.kMMMWKl.\n");
-   fprintf(stderr, " ,:':XMMMWWMMMMMNllckMMMMMKKWMMMWo.::,             RELEaSE DaTE::\n");
-   fprintf(stderr, "     ;lKMMMMMMMMMKkONMMMMMMMMMMOc.:                           %s\n", getBuildDate().c_str());
-   fprintf(stderr, "   ,::' ;KWMMMMMWKkONMMMMMMNNXk:: :,\n");
-   fprintf(stderr, "        ,coollodll:odxkkkkxocc;O\n");
-   fprintf(stderr, "       '0MMMNx;.,doOKKKKKKKk:d:                    GReeTz::\n");
-   fprintf(stderr, "       ,kMMMMMWkc;l0kKKKK00KKod                             L0wNaGe L4bZ\n");
-   fprintf(stderr, "     lc:clo0WMMMMo,Ox0xl0xxkl;llc:                          Pl4st1K DuCk\n");
-   fprintf(stderr, "    :OWMMW0ocOMMMl'k00kxOk:cONMMWKl;                               Pet3y\n");
-   fprintf(stderr, "   '0MMMMMMMO,dkl.,,ooddl'oWMMMMMMW:                               N3X15\n");
-   fprintf(stderr, "   'KMMMMMMMMl.,,clcod00c'XMMMMMMMMc\n");
-   fprintf(stderr, "   ,oWMMMMMMWc',,:OK0llc,'KMMMMMMM0,   ~ Cyber Terrorists Since 2004 ~\n");
-   fprintf(stderr, "    :l0WMMMXo;oolcx00l;;l::0WMMWKd:\n");
-   fprintf(stderr, "     klclollx     kxx    dolloollx\n");
-   fprintf(stderr, " \n");
-   fprintf(stderr, "     \"if you see an avatar with their lights off don't flash yor lights\n");
-   fprintf(stderr, "        at them because they are goons in training and will run you off\n");
-   fprintf(stderr, "                                         the road and crash your client\"\n");
+   fprintf(stderr, "    lslint version %s (%s)\n", (VERSION, getBuildDate().c_str()));
    fprintf(stderr, " \n");
    fprintf(stderr, "Modified by: Makopoppo @ https://github.com/Makopo/lslint\n");
    fprintf(stderr, "Modified by: Sei Lisa  @ https://github.com/Sei-Lisa/lslint\n");
    fprintf(stderr, "VS 2015  by: Xenhat    @ https://github.com/Ociidii-Works/lslint\n");

If desired, maybe adding the "shout out" and "special thanks" sections from the README.md as a simple list here would make sense.


FYI @awozniak, @pclewis, @XenHat

I don't know if it will be different in other systems, I doubt it, but in Linux, --help shows the help. Not that that's intended, but it does for me, because -- is interpreting the second dash as an option character that doesn't exist. Even lslint -- shows the help for me.

lslint without arguments does not fail for me; it expects the script in stdin and that seems useful.

I agree on the mismatch between stated version and release version. I was sad to see it happen at every release.

--version could produce something more useful, but the documented version flag is -V.

I don't agree on removing the kitty and the other text. I suggest adding an explicit --version flag with a shorter version text, and leave -V as is, except for the version number of course.

lslint without any option seems to work fine for me.

$ cat ~/xxx/test6.lsl | lslint 
 WARN:: (  1,  9): function `x' declared but never used.
 WARN:: (  4,  7): state `other' declared but never used.
TOTAL:: Errors: 0  Warnings: 2

This is USAGE, not version info.

Usage: lslint [options] [input]
Options: 
	-m		Flag: Use Mono rules for the analysis (default on)
	-b <file>	Load builtin functions from file
	-t		Show tree structure.
	-l		Show line/column information as range
	-p		Add the file path to the result
	-v		Be verbose
	-S		Don't sort log messages
	-#		Show error codes (for debugging/testing)
	-A		Check error assertions (for debugging/testing)
	-i		Flag: Ignore preprocessor directives (default off)
	-u		Flag: Warn about unused event parameters (default off)
	-w		Flag: Enable switch statements (default off)
	-z		Flag: Enable lazy list syntax (default off)
	-G		Flag: Enable god mode (default off)
	-V		Print version and exit.

--version is simply not yet assigned to do anything, resulting in showing usage info. -- is the same. It can be difficult to assign any feature to --version, taking a look at current lslmini.cc implementation. -v could be implemented easier though.

I don't want to erase original creator's signature in version info, since I respect them. If I would implement -v to display this kitty.

So, what if -v without any option and file show version info?

-v is taken for verbose. I suggested --version because it's pretty standard among many applications. It's also not unheard of to have two version info options, one more "machine-readable" and another more "user-friendly". gcc and gimp are close to that; try gcc -v and gcc --version, or gimp -v and gimp --version.

Since creating a full-fledged standard command-line parser is overkill for this application, I'd suggest to add it as a hack. The hack would consist of scanning every argv[0..argc-1] before any other parsing of the command line, looking for the string --version and, if present, call shortversion() and exit.

I can submit the hack as a PR. The contents of the output would remain open.

Now it makes sense to me. I'll wait PR for now. Thank you.