Here is my second pass at a more robust help function.  I've
incorporated the changes suggested by Dylan and Philip (below)
and many others.  I will try to list all the changes here.

    o Added -q --quiet flag to suppress non-error output.

    o Added -n --no-browser flag to pretend we couldn't find a
      browser to test resulting error messages.

    o Added -t --text flag to pretend we are in text mode even if
      we are really in X windows.  This makes it easier to test
      text mode functionality.

    o Added while loop to handle multiple command line parameters.

    o Go into quiet mode if we see the variable $fish_quiet_help.

    o Added -s --shutup flag to change default to quiet mode.

    o Added -v --verbose flag to change default to verbose mode.

    o Added warning if there are extra command line parameters.
      I'm displaying the help anyway which I think would be less
      frustrating for the user but if there are extra parameters
      and the first one is unrecognized then I abort.

    o Print warning if we couldn't find the help topic/command/etc
      they were asking for before taking them to the help index.
      In text mode I delay 5 seconds after printing the message
      because it often (always?) gets erased by the text browser.
      This is disabled by the -q, --quiet flag.

    o Print out lots of browser information after we display help
      with a browser as suggested by Philip and Dylan.

    o Print more extensive instructions if we couldn't find a browser.

    o Added recognition of "help topics" which will print out a topics
      man page but I haven't uploaded that new man page yet.  Please
      ignore this for now so we can discuss it in a separate thread
      about the help man page(s).

    o Changed every printf to echo.  I found this much easier to read.

    o Slightly changed format of comments to make them easier to line
      wrap in Gvim.

    o Added support for $CONSOLE_BROWSER environment variable.  It
      takes top priority in text mode and does nothing in graphics
      mode.  I chose CONSOLE_ instead of TEXT or TEXT_ so we can
      use a similar CONSOLE_EDITOR in funced.  I think TEXT_EDITOR
      would be very confusing since all the editors are text editors.

    o fixed one typo.


NOTES:

Many of the new messages change depending if we are in text mode
or graphics mode.

I used an ugly kludge to print out a list of all the browsers we
looked for.  I create a temporary directory and touch a file with
the name of each browser and then do an ls.  This allows me to
take advantage of the formatting ls provides instead of just
printing a long string that gets wrapped at the right edge of the
terminal.  This code only runs when we can't find a browser which
should be a rare occurrence. 

I believe the only external commands I don't check for are "which"
and "ls".  I check for the existence of: mktemp, readlink, basename,
and update-alternative.  If any one of these is missing, I alter the
behavior, so we degrade gracefully.

The --text and --no-browser flags are to aid testing, although I
find the --text flag to be very handy.  You can always display
in text mode by setting $BROWSER to a known text browser.

I realize I may have gone way overboard with the --verbose and
--shutup flags.  These two flags erase and set the global
$fish_quiet_help variable.  The default, of course, is verbose mode.
I did not KISS.  One compromise would be to only allow the complete
--shutup and --verbose and no abbreviations.  Then don't mention
them in the simple "help -h".


Peace, James

Attachment: help.fish
Description: Binary data

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to