diff --git a/twander.py b/twander.py index 91ee3ca..5bb40c8 100755 --- a/twander.py +++ b/twander.py @@ -4,7 +4,7 @@ # For Updates See: http://www.tundraware.com/Software/twander PROGNAME = "twander" -RCSID = "$Id: twander.py,v 1.94 2002/12/09 20:16:53 tundra Exp $" +RCSID = "$Id: twander.py,v 1.95 2002/12/10 02:47:31 tundra Exp $" VERSION = RCSID.split()[2] @@ -209,6 +209,7 @@ COMMENT = r"#" # Comment character ENVVBL = r'$' # Symbol denoting an environment variable MAXNESTING = 32 # Maximum depth of nested variable definitions +QUOTECHAR = '\"' # Character to use when quoting builtin substitutions reVAR = r"\[.*?\]" # Regex describing variable notation @@ -272,18 +273,19 @@ ##### uTable = [PROGNAME + " " + VERSION + " - Copyright 2002, TundraWare Inc., All Rights Reserved\n", - "usage: " + PROGNAME + " [-bcdfhnqrsvwxy] [startdir] where,\n", + "usage: " + PROGNAME + " [-bcdfhnqrstvwxy] [startdir] where,\n", " startdir name of directory in which to begin (default: current dir)", " -b color background color (default: black)", " -c file name of configuration file (default: $HOME/." + PROGNAME + " or PROGDIR/." + PROGNAME + ")", - " -d turn on debugging", + " -d turn on debugging (default: debugging off)", " -f color foreground color (default: green)", " -h print this help information", " -n name name of font to use (default: courier)", " -q quiet mode - no warnings (default: warnings on)", " -r turn off automatic content refreshing (default: refresh on)", " -s size size of font to use (default: 12)", + " -t no quoting when substituting builtin variables (default: quoting on)", " -v print detailed version information", " -w wght weight/style of font to use (default: bold)", " -x width window width (default: 60)", @@ -805,23 +807,22 @@ # cmd == null means no matching command key - do nothing # Otherwise, replace config tokens with actual file/dir names + if cmd: # Replace runtime-determined tokens selection = UI.LastInSelection() selections = "" - for selected in UI.AllSelection(): - selections += selected + " " - dselections = "" - for sel in selections.split(): - dselections += UI.CurrentDir + sel + " " - - cmd = cmd.replace(DIR, UI.CurrentDir) - cmd = cmd.replace(DSELECTION, UI.CurrentDir + selection) + for selected in UI.AllSelection(): + + dselections += QUOTECHAR + UI.CurrentDir + selected + QUOTECHAR + " " + + cmd = cmd.replace(DIR, QUOTECHAR + UI.CurrentDir + QUOTECHAR) + cmd = cmd.replace(DSELECTION, QUOTECHAR + UI.CurrentDir + selection + QUOTECHAR) cmd = cmd.replace(DSELECTIONS, dselections) - cmd = cmd.replace(SELECTION, selection) + cmd = cmd.replace(SELECTION, QUOTECHAR + selection + QUOTECHAR) cmd = cmd.replace(SELECTIONS, selections) # Just dump command if we're debugging @@ -1458,7 +1459,7 @@ # Command line processing try: - opts, args = getopt.getopt(sys.argv[1:], '-b:c:df:hn:qrs:vw:x:y:') + opts, args = getopt.getopt(sys.argv[1:], '-b:c:df:hn:qrs:tvw:x:y:') except getopt.GetoptError: Usage() sys.exit(1) @@ -1485,6 +1486,8 @@ AUTOREFRESH = FALSE if opt == "-s": FSZ = val + if opt == "-t": + QUOTECHAR = "" if opt == "-v": print RCSID sys.exit(0)