support -V, --version

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-09-12 00:06:59 +02:00
parent 1cc7600c9c
commit 5260f230e5

View file

@ -100,6 +100,7 @@ class Cdist:
self.base_dir = home self.base_dir = home
else: else:
self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
self.conf_dir = os.path.join(self.base_dir, "conf") self.conf_dir = os.path.join(self.base_dir, "conf")
self.global_explorer_dir = os.path.join(self.conf_dir, "explorer") self.global_explorer_dir = os.path.join(self.conf_dir, "explorer")
self.lib_dir = os.path.join(self.base_dir, "lib") self.lib_dir = os.path.join(self.base_dir, "lib")
@ -611,10 +612,16 @@ if __name__ == "__main__":
# help='Operate on multiple hosts sequentially', # help='Operate on multiple hosts sequentially',
# action='store_false', dest='parallel') # action='store_false', dest='parallel')
parser.add_argument('-V', '--version', help='Show version',
action='version', version='%(prog)s ' + VERSION)
args = parser.parse_args(sys.argv[1:]) args = parser.parse_args(sys.argv[1:])
if args.debug: if args.debug:
logging.root.setLevel(logging.DEBUG) logging.root.setLevel(logging.DEBUG)
print(args)
sys.exit(1)
if args.banner: if args.banner:
banner() banner()
sys.exit(0) sys.exit(0)