VirtualBox

Ignore:
Timestamp:
Apr 22, 2010 10:35:33 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
60467
Message:

VBoxShell: add reading/saving of history; add support for spaces in machine names on completion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxShell/vboxshell.py

    r28614 r28618  
    3232import shlex
    3333import time
     34import re
     35
     36HISTORY_FILENAME=".vboxshell_history"
    3437
    3538# Simple implementation of IConsoleCallback, one can use it as skeleton
     
    179182                # although it has autoconversion, we need to cast
    180183                # explicitly for subscripts to work
    181                 word = str(m.name)
     184                word = re.sub("(?<!\\\\) ", "\\ ", str(m.name))
    182185                if word[:n] == text:
    183186                    matches.append(word)
     
    193196        return matches
    194197
    195 
    196198def autoCompletion(commands, ctx):
    197199  import platform
     
    204206  completer = CompleterNG(comps, ctx)
    205207  readline.set_completer(completer.complete)
     208  delims = readline.get_completer_delims()
     209  readline.set_completer_delims(re.sub("[\\.]", "", delims)) # remove some of the delimiters
    206210  # OSX need it
    207211  if platform.system() == 'Darwin':
     
    19611965    autoCompletion(commands, ctx)
    19621966
     1967    if g_hasreadline and os.path.exists(HISTORY_FILENAME):
     1968        readline.read_history_file(HISTORY_FILENAME)
     1969
    19631970    # to allow to print actual host information, we collect info for
    19641971    # last 150 secs maximum, (sample every 10 secs and keep up to 15 samples)
     
    19901997    except:
    19911998        pass
     1999    if g_hasreadline:
     2000        readline.write_history_file(HISTORY_FILENAME)
    19922001
    19932002def runCommandCb(ctx, cmd, args):
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette