本文整理匯總了Python中cjh.cli.Cli.view_source方法的典型用法代碼示例。如果您正苦於以下問題:Python Cli.view_source方法的具體用法?Python Cli.view_source怎麽用?Python Cli.view_source使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cjh.cli.Cli
的用法示例。
在下文中一共展示了Cli.view_source方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: main
# 需要導入模塊: from cjh.cli import Cli [as 別名]
# 或者: from cjh.cli.Cli import view_source [as 別名]
def main():
"""
Writes requested modifications to the 'config.json' file, and sends
some kind of feedback to stdout.
"""
if ARGS.s is not None:
CONFIG.write_to_config_file(shell=ARGS.s)
if ARGS.e is not None:
CONFIG.write_to_config_file(editor=ARGS.e)
if ARGS.t is not None:
CONFIG.write_to_config_file(terminal=ARGS.t)
if ARGS.l is not None:
CONFIG.write_to_config_file(language=ARGS.l)
# config_dict = {'shell':shell}
# with open(filename, 'w') as outfile: json.dump(
# config_dict, outfile, indent=2)
string = ''
if (ARGS.v >= 1 and ARGS.s is not None) or not (
ARGS.e or ARGS.s or ARGS.t or ARGS.l):
string += "\n shell: '{}'".format(shell)
if (ARGS.v >= 1 and ARGS.e is not None) or not (
ARGS.e or ARGS.s or ARGS.t or ARGS.l):
string += "\n editor: '{}'".format(editor)
if (ARGS.v >= 1 and ARGS.t is not None) or not (
ARGS.e or ARGS.s or ARGS.t or ARGS.l):
string += "\nterminal: '{}'".format(terminal)
if (ARGS.v >= 1 and ARGS.l is not None) or not (
ARGS.e or ARGS.s or ARGS.t or ARGS.l):
string += "\nlanguage: '{}'".format(language)
if len(string) > 0:
print(string + '\n') # pylint: disable=C0325
if (ARGS.v >= 2) or (
not (ARGS.e or ARGS.s or ARGS.t or ARGS.l) and ARGS.v >= 1):
Cli.view_source(FILENAME)
if ARGS.s or ARGS.e or ARGS.t or ARGS.l:
Cli.report_filesave(FILENAME)