add '--version' command line option

Just output version information and exit.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
FUJITA Tomonori 2012-06-28 12:55:05 +09:00
parent bead388d47
commit 1262ead05c

View File

@ -27,6 +27,7 @@ monkey.patch_all()
from ryu import log from ryu import log
log.early_init_log(logging.DEBUG) log.early_init_log(logging.DEBUG)
from ryu import version
from ryu import utils from ryu import utils
from ryu.app import wsgi from ryu.app import wsgi
from ryu.base.app_manager import AppManager from ryu.base.app_manager import AppManager
@ -34,6 +35,7 @@ from ryu.controller import controller
FLAGS = gflags.FLAGS FLAGS = gflags.FLAGS
gflags.DEFINE_bool('version', False, 'output version information and exit')
gflags.DEFINE_multistring('app_lists', gflags.DEFINE_multistring('app_lists',
[], [],
'application module name to run') 'application module name to run')
@ -42,6 +44,11 @@ gflags.DEFINE_multistring('app_lists',
def main(): def main():
utils.find_flagfile() utils.find_flagfile()
args = FLAGS(sys.argv) args = FLAGS(sys.argv)
if FLAGS.version:
print 'ryu-manager %s' % version
sys.exit(0)
log.init_log() log.init_log()
if len(args) > 1: if len(args) > 1: