def main(args):
os.environ[ENV_ADDITIONAL_USER_AGENT] = 'AZURECLISHELL/' + __version__
parser = argparse.ArgumentParser(prog='az-shell')
parser.add_argument(
'--style', dest='style', help='the colors of the shell',
choices=get_options())
args = parser.parse_args(args)
azure_folder = cli_config_dir()
if not os.path.exists(azure_folder):
os.makedirs(azure_folder)
ACCOUNT.load(os.path.join(azure_folder, 'azureProfile.json'))
CONFIG.load(os.path.join(azure_folder, 'az.json'))
SESSION.load(os.path.join(azure_folder, 'az.sess'), max_age=3600)
config = SHELL_CONFIGURATION
shell_config_dir = azclishell.configuration.get_config_dir
if args.style:
given_style = args.style
config.set_style(given_style)
else:
given_style = config.get_style()
style = style_factory(given_style)
if config.BOOLEAN_STATES[config.config.get('DEFAULT', 'firsttime')]:
print("When in doubt, ask for 'help'")
config.firsttime()
shell_app = Shell(
completer=AZCOMPLETER,
lexer=AzLexer,
history=FileHistory(
os.path.join(shell_config_dir(), config.get_history())),
app=APPLICATION,
styles=style
)
shell_app.run()
评论列表
文章目录