VirtualBox

Ignore:
Timestamp:
Sep 24, 2008 2:32:54 PM (16 years ago)
Author:
vboxsync
Message:
  • better macro docs
  • implemented eval command in Vbox shell
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/python/sample/shellcommon.py

    r12411 r12689  
    300300   return 0
    301301
     302
     303def evalCmd(ctx, args):
     304   expr = ' '.join(args[1:])
     305   try:
     306        exec expr
     307   except Exception, e:
     308        print 'failed: ',e
     309        if g_verbose:
     310            traceback.print_exc()
     311   return 0
     312
    302313aliases = {'s':'start', 
    303314           'i':'info',
     
    318329            'aliases':['Shows aliases', aliasesCmd],
    319330            'verbose':['Toggle verbosity', verboseCmd],
    320             'setvar':['Set VMs variable: "setvar Fedora BIOSSettings.ACPIEnabled True"', setvarCmd],
     331            'setvar':['Set VMs variable: setvar Fedora BIOSSettings.ACPIEnabled True', setvarCmd],
     332            'eval':['Evaluate arbitrary Python construction: eval for m in getMachines(ctx): print m.name,"has",m.memorySize,"M"', evalCmd],
    321333            'quit':['Exits', quitCmd],
    322334            'host':['Show host information', hostCmd]}
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