-? or -h command option support in Tcl-core

From: Andreas Sievers (andreas.sievers_at_t-online.de)
Date: 03/28/04

  • Next message: David S. Cargo: "Re: TIP #176: Add String Index Values"
    Date: Sun, 28 Mar 2004 00:20:50 +0100
    
    

    Currently, there´s no official way to get straight forward information about
    a command, like options or subcommands dynamically.

    On the other hand, you will get a lot of information via the build in
    error-mechanism, but this depends heavily on the context.
    ie. a single puts will return "wrong # args: should be "puts ?-nonewline?
    ?channelId? string".

    If you enter a Tk-command like text, you will only get back "wrong # args:
    should be "text pathName ?options?", which tells nothing about available
    options and subcommands.

    You have the chance to try "text -?" to cause another error which will
    result in: "bad window path name "-?", but that will not really help you, if
    you are a novice.

    If you are more experienced, you can try "text .t", which will instanciate a
    text-widget and then query for options:

    .t configure

    which will result in a list of possible options (but messing you caused by
    the format with additional info). And then you can try

    .t -? for all subcommands

    To be able to query, you MUST create a widget instance and then (if not
    needed any more) destroy it again.

    But there´s no way to query allowed options and/or subcommands directly and
    context-independent, ie. text -?

    I thought about to write a package introducing a help command, which will
    return informations about a command (ie. help <command>). But, unless you
    don´t want to write a hard-coded list of commands and their options, this
    has to use the available error-information, like I did it for the current
    ASED version, which is quite arkward. After all, I´d prefer a command option
    supported by the tcl-core to query those informations or a help command,
    implemented in the tcl-core, which would not only help to develop
    online-assistance for Editors/IDEs, but also is a good habbit on regular
    unix-commands and could be a great help, if you work interactively in a
    tcl-shell.

    I wonder, if it would be possible to combine all informations available for
    a command by the error-information to realize a context-independent query-co
    mmand.
    I know that this might cause incompatibilities, since some commands
    currently accept -? as a valid option (ie puts). Maybe a help command or an
    expansion of the info command (like info commands command) might be an
    alternative, if it would return the needed information.

    I´m really interested in hearing what other people think about that.


  • Next message: David S. Cargo: "Re: TIP #176: Add String Index Values"

    Relevant Pages

    • Re: Fixing or REPLACING I.E.6 - command prompt & average PC user
      ... ## "Command line reference" brought up all kinds of information for my HP ... The command window just sat there with a blinking cursor. ... > so you could enter nslookup subcommands or more specifically ... > is not detected you will get an error message. ...
      (microsoft.public.windows.inetexplorer.ie6.browser)
    • Re: Counting Concurrent timed events
      ... When you make a command button, Access gives it an ambiguous name like "Command2" ... ... then compile your code ... Exit Sub ... what you need to be able to do is replace the SQL using a different date before you run the query that uses it. ...
      (microsoft.public.access.queries)
    • Re: Multiple table in dataset query
      ... If a row is marked as Modified, it will run your query defined in the ... Update Command object. ... Dim UpdateStaffCmd As New OleDb.OleDbCommand ... Private Sub frmStaff_Load(ByVal sender As System.Object, ...
      (microsoft.public.dotnet.framework.adonet)
    • Re: Complex form popup problem: warning...longwinded
      ... command button that launched the other form. ... main form that allows the user to fill out the scenario information, ... The majority of the fields in the query that are the recordsource of the ... remainder belong to the new record that was programmatically saved. ...
      (microsoft.public.access.formscoding)
    • RE: ODBC query in VB code Need HELP
      ... The vb part could be to set up a query string by concatenation or to go ... or call when you press your command button ... the connection string, cursor location, etc. ...
      (microsoft.public.access.formscoding)