VirtualBox

忽略:
時間撮記:
2008-8-29 下午01:39:52 (16 年 以前)
作者:
vboxsync
訊息:

fixed minor issues with completion and others

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/libs/xpcom18a4/python/sample/vboxshell.py

    r11746 r11816  
    11#!/usr/bin/python
    22#
    3 ####################################################################################
    4 # This program is a simple interactive shell for VirtualBox. You can query         #
    5 # information and issue commands from a simple command line.                       #
    6 #                                                                                  #
    7 # It also provides you with examples on how to use VirtualBox' Python API.         #
    8 # This shell is even somewhat documented and supports TAB-completion and history   #
    9 # if you have Python readline installed.                                           #
    10 #                                                                                  #
    11 #                                                Enjoy.                            #
    12 ####################################################################################
     3#################################################################################
     4# This program is a simple interactive shell for VirtualBox. You can query      #
     5# information and issue commands from a simple command line.                    #
     6#                                                                               #
     7# It also provides you with examples on how to use VirtualBox' Python API.      #
     8# This shell is even somewhat documented and supports TAB-completion and        #
     9# history if you have Python readline installed.                                #
     10#                                                                               #
     11#                                                Enjoy.                         #
     12#################################################################################
    1313#
    1414# To make it work, the following variables have to be set.
     
    2121# To allow library resolution
    2222#  export LD_LIBRARY_PATH=$VBOX_PROGRAM_PATH
    23 # Additionally, on 64-bit Solaris, you need to use 64-bit Python from /usr/bin/amd64/python
    24 # and due to quirks in native modules loading of Python do the following:
     23# Additionally, on 64-bit Solaris, you need to use 64-bit Python from
     24# /usr/bin/amd64/python and due to quirks in native modules loading of
     25# Python do the following:
    2526#   mkdir $VBOX_PROGRAM_PATH/64
    2627#   ln -s $VBOX_PROGRAM_PATH/VBoxPython.so $VBOX_PROGRAM_PATH/64/VBoxPython.so
     
    8182            if word[:n] == text:
    8283                matches.append(word)
     84            word = str(m.id)[1:-1]
     85            if word[:n] == text:
     86                    matches.append(word)
    8387
    8488        return matches
     
    165169    mach = None
    166170    for m in getMachines(ctx):
    167         if m.id == id or m.name == id:
     171        if str(m.id) == '{'+id+'}' or m.name == id:
    168172            mach = m
    169173            break
     
    175179        return None
    176180    id = args[1]
    177     return machById(ctx, id)
     181    m = machById(ctx, id)
     182    if m == None:
     183        print "Machine '%s' is unknown, use list command to find available machines" %(id)
     184    return m
    178185
    179186def helpCmd(ctx, args):
     
    227234        type = args[2]
    228235    else:
    229         type = "gui"
     236        type = "GUI/Qt4"
    230237    startVm(ctx['mgr'], ctx['vb'], mach, type)
    231238    return 0
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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