1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Suggestions for V12

Discussion in 'Suggestions' started by Steve Fabian, Oct 30, 2009.

  1. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    SET/ALIAS/FUNCTION/ASSOC/FTYPE

    1/ For objects defined by the above commands one often needs the name of an
    object, given its value, possibly as a subset or wildcard. A consistent set
    of new options for these commands to make such a report would be very
    useful.

    2/ An option that would provide "tabular" output, i.e., whitespace replacing
    the "=" sign normally separating the objects' names from their values to
    vertically align the values would be very useful for visual inspection as
    well as for automated processing.

    3/ A new /O: option, to order the output by N(ame) or by V(alue), either
    ascending or descending, including the choice between "intuitive" (numeric)
    v. strictly alphanumeric order (as with DIR).
    --
    Steve
     
  2. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,177
    Likes Received:
    11
    Steve,

    Option #2 can be easily done using a BTM file. The following example
    displays a list in columns.
    I tried to genericize this batch file to accept both the command and the
    column size.

    setlocal
    if .%1==. .or. .%2==. (echo usage %0 cmd column & quit)
    setdos /x-145
    do a in /P %1
    echo %@left[%2,%@WORD["=",0,%a]%@repeat[ ,%2]]%@word["=",1-100,%a]
    enddo
    endlocal

    Examples:
    foo alias 11
    foo set 25

    -Scott


    Steve F畸i疣 <> wrote on 10/30/2009 01:54:12 PM:


    an

    set

    replacing


    as


    (numeric)

     
  3. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    samintz wrote:
    | Steve,
    |
    | Option #2 can be easily done using a BTM file. The following example
    | displays a list in columns.
    | I tried to genericize this batch file to accept both the command and
    | the
    | column size.
    |
    | setlocal
    | if .%1==. .or. .%2==. (echo usage %0 cmd column & quit)
    | setdos /x-145
    | do a in /P %1
    | echo %@left[%2,%@WORD["=",0,%a]%@repeat[
    | ,%2]]%@word["=",1-100,%a]
    | enddo
    | endlocal

    Scott,
    thanks for the tip. In the tc_plugins group I did just this kind of thing,
    with the display command very similar to yours, using @FORMAT[] to
    columnize. Your solution is more generic for the object value if it contains
    embedded = signs.

    Similar methods are possible to do all of the issues, e.g., in the DO loop
    above one could ECHO only if the value contains the desired string. Once
    could save all output in a file, and sort it in the desired order.

    What I am looking for is to do it simply, by enhancing the reporting command
    in the way PDIR enhances DIR's reporting format. Another detail: since the
    tables are not very large, it is easy for an internal command to find the
    minimum width required for the object names; a batch file would need to
    either perform the retrieval twice, or save it in a temporary file. With the
    /P option, and considering that all of these tables (except those of ASSOC
    and FTYPE) are already in internal storage, retrieving twice should be the
    faster.
    --
    Steve
     
  4. nickles

    Joined:
    Jun 24, 2008
    Messages:
    220
    Likes Received:
    0
    Once more I'd suggest having [tab] work in tokens containing environment variables, like so (^ denotes the cursor position):

    dir %systemroot%\a^[tab]*

    which - on continuous key presses - should return the nth name in %systemroot% starting with 'a' (w/o the need to expand %systemroot% to e.g. "c:\windows\system32").

    Right now one has to use the following command sequence to enumerate the 'a' names:

    dir %systemroot%\a^[ctrl-x][tab]*

    This sequence also forcibly expands %systemroot% to "c:\windows\system32", which is usually not what is wanted.

    nickles
     

Share This Page