def cli(is_json):
"""
See the aeriscloud version information
"""
versions = {
'aeriscloud': {'version': ac_version},
'ansible': {'version': ansible_version},
'vagrant': {'version': vagrant_version()},
'virtualbox': {'version': virtualbox_version()},
'ruby': _ruby_version(),
'python': {'version': _python_version()},
'git': {'version': str(sh.git('--version'))[12:].strip()}
}
# aeriscloud get information
if os.path.exists(os.path.join(aeriscloud_path, '.git')):
repo = Repo(aeriscloud_path)
rev = str(repo.head.commit)[:8]
branch = str(repo.active_branch)
versions['aeriscloud']['revision'] = rev
versions['aeriscloud']['branch'] = branch
# operating system
linux_version = _linux_version()
if linux_version:
versions['linux'] = linux_version
else:
try:
# this is for osx
sw_vers = dict([map(unicode.strip, line.split(':'))
for line in sh.sw_vers()])
versions['osx'] = {
'name': sw_vers['ProductName'],
'version': sw_vers['ProductVersion'],
'build': sw_vers['BuildVersion']
}
except sh.CommandNotFound:
pass
try:
uname = str(sh.uname('-sr')).strip()
versions['kernel'] = {'version': uname}
except sh.CommandNotFound:
pass
if is_json:
click.echo(json.dumps(versions))
else:
click.echo(render_cli('version', **versions))
评论列表
文章目录