VirtualBox

Changeset 21245 in vbox


Ignore:
Timestamp:
Jul 6, 2009 10:10:55 AM (16 years ago)
Author:
vboxsync
Message:

Python shell: minor improvments

File:
1 edited

Legend:

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

    r21204 r21245  
    203203
    204204def split_no_quotes(s):
    205    #return s.split()
    206205    return shlex.split(s)
    207206
     
    338337         'stats':      lambda: guestStats(ctx, mach),
    339338         'guest':      lambda: guestExec(ctx, mach, console, args),
    340          'monitorGuest': lambda: monitorGuest(ctx, mach, console, args)
     339         'monitorGuest': lambda: monitorGuest(ctx, mach, console, args),
     340         'save' :     lambda: console.saveState().waitForCompletion(-1)
    341341         }
    342342    try:
     
    489489    return 0
    490490
     491def saveCmd(ctx, args):
     492    mach = argsToMach(ctx,args)
     493    if mach == None:
     494        return 0
     495    cmdExistingVm(ctx, mach, 'save', '')
     496    return 0
     497
    491498def statsCmd(ctx, args):
    492499    mach = argsToMach(ctx,args)
     
    530537    return 1
    531538
    532 def aliasesCmd(ctx, args):
     539def aliasCmd(ctx, args):
     540    if (len(args) == 3):
     541        aliases[args[1]] = args[2]
     542        return 0
     543   
    533544    for (k,v) in aliases.items():
    534545        print "'%s' is an alias for '%s'" %(k,v)
     
    552563
    553564   return 0
    554 
    555565
    556566def monitorGuestCmd(ctx, args):
     
    667677           'l':'list',
    668678           'h':'help',
    669            'a':'aliases',
     679           'a':'alias',
    670680           'q':'quit', 'exit':'quit',
    671681           'v':'verbose'}
     
    677687            'pause':['Pause virtual machine', pauseCmd, 0],
    678688            'resume':['Resume virtual machine', resumeCmd, 0],
     689            'save':['Save execution state of virtual machine', saveCmd, 0],
    679690            'stats':['Stats for virtual machine', statsCmd, 0],
    680691            'powerdown':['Power down virtual machine', powerdownCmd, 0],
     
    682693            'list':['Shows known virtual machines', listCmd, 0],
    683694            'info':['Shows info on machine', infoCmd, 0],
    684             'aliases':['Shows aliases', aliasesCmd, 0],
     695            'alias':['Control aliases', aliasCmd, 0],
    685696            'verbose':['Toggle verbosity', verboseCmd, 0],
    686697            'setvar':['Set VMs variable: setvar Fedora BIOSSettings.ACPIEnabled True', setvarCmd, 0],
    687             'eval':['Evaluate arbitrary Python construction: eval for m in getMachines(ctx): print m.name,"has",m.memorySize,"M"', evalCmd, 0],
     698            'eval':['Evaluate arbitrary Python construction: eval \'for m in getMachines(ctx): print m.name,"has",m.memorySize,"M"\'', evalCmd, 0],
    688699            'quit':['Exits', quitCmd, 0],
    689700            'host':['Show host information', hostCmd, 0],
    690             'guest':['Execute command for guest: guest Win32 console.mouse.putMouseEvent(20, 20, 0, 0)', guestCmd, 0],
     701            'guest':['Execute command for guest: guest Win32 \'console.mouse.putMouseEvent(20, 20, 0, 0)\'', guestCmd, 0],
    691702            'monitorGuest':['Monitor what happens with the guest for some time: monitorGuest Win32 10', monitorGuestCmd, 0],
    692703            'monitorVbox':['Monitor what happens with Virtual Box for some time: monitorVbox 10', monitorVboxCmd, 0],
Note: See TracChangeset for help on using the changeset viewer.

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