本文整理汇总了Python中clint.textui.colored.cyan方法的典型用法代码示例。如果您正苦于以下问题:Python colored.cyan方法的具体用法?Python colored.cyan怎么用?Python colored.cyan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clint.textui.colored
的用法示例。
在下文中一共展示了colored.cyan方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: display_help
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import cyan [as 别名]
def display_help():
# Clear screen and show the help text
call(['clear'])
puts(colored.cyan('Available commands (press any key to exit)'))
puts(' enter - Connect to your selection')
puts(' crtl+c | q - Quit sshmenu')
puts(' k (up) - Move your selection up')
puts(' j (down) - Move your selection down')
puts(' h - Show help menu')
puts(' c - Create new connection')
puts(' d - Delete connection')
puts(' e - Edit connection')
puts(' + (plus) - Move connection up')
puts(' - (minus) - Move connection down')
# Hang until we get a keypress
readchar.readkey()
示例2: txn_preference_chooser
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import cyan [as 别名]
def txn_preference_chooser(user_prompt=DEFAULT_PROMPT):
puts('How quickly do you want this transaction to confirm? The higher the miner preference, the higher the transaction fee.')
TXN_PREFERENCES = (
('high', '1-2 blocks to confirm'),
('medium', '3-6 blocks to confirm'),
('low', '7+ blocks to confirm'),
# ('zero', 'no fee, may not ever confirm (advanced users only)'),
)
for cnt, pref_desc in enumerate(TXN_PREFERENCES):
pref, desc = pref_desc
with indent(2):
puts(colored.cyan('%s (%s priority): %s' % (cnt+1, pref, desc)))
choice_int = choice_prompt(
user_prompt=user_prompt,
acceptable_responses=range(1, len(TXN_PREFERENCES)+1),
default_input='1', # high pref
show_default=True,
)
return TXN_PREFERENCES[int(choice_int)-1][0]
示例3: offline_tx_chooser
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import cyan [as 别名]
def offline_tx_chooser(wallet_obj):
puts('What do you want to do?:')
puts(colored.cyan('1: Generate transaction for offline signing'))
puts(colored.cyan('2: Sign transaction offline'))
puts(colored.cyan('3: Broadcast transaction previously signed offline'))
puts(colored.cyan('\nb: Go Back\n'))
choice = choice_prompt(
user_prompt=DEFAULT_PROMPT,
acceptable_responses=range(0, 3+1),
quit_ok=True,
default_input='1',
show_default=True,
)
verbose_print('Choice: %s' % choice)
if choice is False:
return
elif choice == '1':
return generate_offline_tx(wallet_obj=wallet_obj)
elif choice == '2':
return sign_tx_offline(wallet_obj=wallet_obj)
elif choice == '3':
return broadcast_signed_tx(wallet_obj=wallet_obj)
示例4: logDebug
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import cyan [as 别名]
def logDebug(text, type):
if type == DEBUG_NORMAL:
puts(colored.cyan(text))
else: # DEBUG_VERBOSE
puts(colored.magenta(text))
示例5: release
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import cyan [as 别名]
def release():
"""Bump version, tag, build, gen docs."""
if check_staged():
raise EnvironmentError('There are staged changes, abort.')
if check_unstaged():
raise EnvironmentError('There are unstaged changes, abort.')
bump()
tag()
build()
doc_gen()
puts(colored.yellow("Remember to upload documentation and package:"))
with indent(2):
puts(colored.cyan("shovel doc.upload"))
puts(colored.cyan("shovel version.upload"))
示例6: connection_create
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import cyan [as 别名]
def connection_create():
global config_name
call(['clear'])
puts(colored.cyan('Create new connection entry'))
puts('')
host = input('Hostname (user@machine): ')
if host is '':
puts('')
puts('Nothing done')
time.sleep(TRANSITION_DELAY_TIME)
return
friendly = input('Description []: ')
command = input('Command [ssh]: ')
options = input('Command Options []: ')
# Set the defaults if our input was empty
command = 'ssh' if command == '' else command
options = [] if options == '' else options.split()
# Append the new target to the config
config = json.loads(resources.user.read(config_name))
config['targets'].append({'command': command, 'host': host, 'friendly': friendly, 'options': options})
# Save the new config
resources.user.write(config_name, json.dumps(config, indent=4))
update_targets()
puts('')
puts('New connection added')
time.sleep(TRANSITION_DELAY_TIME)
示例7: connection_edit
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import cyan [as 别名]
def connection_edit(selected_target):
global targets, config_name
call(['clear'])
puts(colored.cyan('Editing connection %s' % targets[selected_target]['host']))
puts('')
target = targets[selected_target]
while True:
host = input_prefill('Hostname: ', target['host'])
if host is not '':
break
friendly = input_prefill('Description: ', target['friendly'])
command = input_prefill('Command [ssh]: ', 'ssh' if not target.get('command') else target['command'])
options = input_prefill('Options []: ', ' '.join(target['options']))
# Set the defaults if our input was empty
command = 'ssh' if command == '' else command
options = [] if options == '' else options.split()
# Delete the old entry insert the edited one in its place
config = json.loads(resources.user.read(config_name))
del config['targets'][selected_target]
config['targets'].insert(selected_target,
{'command': command, 'host': host, 'friendly': friendly, 'options': options})
resources.user.write(config_name, json.dumps(config, indent=4))
update_targets()
puts('')
puts('Changes saved')
time.sleep(TRANSITION_DELAY_TIME)
示例8: coin_symbol_chooser
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import cyan [as 别名]
def coin_symbol_chooser(user_prompt=DEFAULT_PROMPT, quit_ok=True):
ACTIVE_COIN_SYMBOL_LIST = [x for x in COIN_SYMBOL_LIST if x != 'uro']
for cnt, coin_symbol_choice in enumerate(ACTIVE_COIN_SYMBOL_LIST):
with indent(2):
puts(colored.cyan('%s: %s' % (
cnt+1,
COIN_SYMBOL_MAPPINGS[coin_symbol_choice]['display_name'],
)))
if ACTIVE_COIN_SYMBOL_LIST[4] == 'bcy':
default_input = 5
show_default = True
else:
default_input = None
show_default = False
coin_symbol_int = get_int(
min_int=1,
user_prompt=user_prompt,
max_int=len(ACTIVE_COIN_SYMBOL_LIST),
default_input=default_input,
show_default=show_default,
quit_ok=quit_ok,
)
if not coin_symbol_int:
return False
else:
return ACTIVE_COIN_SYMBOL_LIST[coin_symbol_int-1]
示例9: dump_private_keys_or_addrs_chooser
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import cyan [as 别名]
def dump_private_keys_or_addrs_chooser(wallet_obj):
'''
Offline-enabled mechanism to dump everything
'''
if wallet_obj.private_key:
puts('Which private keys and addresses do you want?')
else:
puts('Which addresses do you want?')
with indent(2):
puts(colored.cyan('1: Active - have funds to spend'))
puts(colored.cyan('2: Spent - no funds to spend (because they have been spent)'))
puts(colored.cyan('3: Unused - no funds to spend (because the address has never been used)'))
puts(colored.cyan('0: All (works offline) - regardless of whether they have funds to spend (super advanced users only)'))
puts(colored.cyan('\nb: Go Back\n'))
choice = choice_prompt(
user_prompt=DEFAULT_PROMPT,
acceptable_responses=[0, 1, 2, 3],
default_input='1',
show_default=True,
quit_ok=True,
)
if choice is False:
return
if choice == '1':
return dump_selected_keys_or_addrs(wallet_obj=wallet_obj, zero_balance=False, used=True)
elif choice == '2':
return dump_selected_keys_or_addrs(wallet_obj=wallet_obj, zero_balance=True, used=True)
elif choice == '3':
return dump_selected_keys_or_addrs(wallet_obj=wallet_obj, zero_balance=None, used=False)
elif choice == '0':
return dump_all_keys_or_addrs(wallet_obj=wallet_obj)
示例10: send_chooser
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import cyan [as 别名]
def send_chooser(wallet_obj):
puts('What do you want to do?:')
if not USER_ONLINE:
puts("(since you are NOT connected to BlockCypher, many choices are disabled)")
with indent(2):
puts(colored.cyan('1: Basic send (generate transaction, sign, & broadcast)'))
puts(colored.cyan('2: Sweep funds into bcwallet from a private key you hold'))
puts(colored.cyan('3: Offline transaction signing (more here)'))
puts(colored.cyan('\nb: Go Back\n'))
choice = choice_prompt(
user_prompt=DEFAULT_PROMPT,
acceptable_responses=range(0, 5+1),
quit_ok=True,
default_input='1',
show_default=True,
)
verbose_print('Choice: %s' % choice)
if choice is False:
return
elif choice == '1':
return send_funds(wallet_obj=wallet_obj)
elif choice == '2':
return sweep_funds_from_privkey(wallet_obj=wallet_obj)
elif choice == '3':
offline_tx_chooser(wallet_obj=wallet_obj)
示例11: announce
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import cyan [as 别名]
def announce(string):
puts(colored.cyan(string))
示例12: config
# 需要导入模块: from clint.textui import colored [as 别名]
# 或者: from clint.textui.colored import cyan [as 别名]
def config(**kwargs):
puts(colored.cyan("Create a new pgrepup config"))
try:
while True:
conf_filename = prompt.query("Configuration filename", default=kwargs['c'])
if os.path.isfile(os.path.expanduser(conf_filename)):
if not prompt.yn("File %s exists " % conf_filename +
"and it'll be overwritten by the new configuration. Are you sure?", default="n"):
# warning. prompt.yn return true if the user's answer is the same of default value
break
else:
break
except KeyboardInterrupt:
puts("\n")
sys.exit(0)
conf = create_config()
puts(colored.cyan("Security"))
conf.add_section("Security")
if prompt.yn("Do you want to encrypt database credentials using a password?", default="y"):
conf.set("Security", "encrypted_credentials", "y")
encrypt('')
puts("You'll be prompted for password every time pgrepup needs to connect to database")
else:
conf.set("Security", "encrypted_credentials", "n")
conf.set(
"Security",
"tmp_folder",
prompt.query("Folder where pgrepup store temporary dumps and pgpass file", "/tmp")
)
conf.set(
"Security",
"app_owner",
prompt.query("Postgresql username as application owner", "app_owner")
)
puts(colored.cyan("Source Database configuration"))
conf.add_section("Source")
conf.set("Source", "host", prompt.query("Ip address or Dns name: "))
conf.set("Source", "port", prompt.query("Port: "))
conf.set("Source", "connect_database", prompt.query("Connect Database: ", default="template1"))
conf.set("Source", "user", prompt.query("Username: "))
pwd = getpass.getpass()
conf.set("Source", "password", encrypt(pwd))
puts(colored.cyan("Destination Database configuration"))
conf.add_section("Destination")
conf.set("Destination", "host", prompt.query("Ip address or Dns name: "))
conf.set("Destination", "port", prompt.query("Port: "))
conf.set("Destination", "connect_database", prompt.query("Connect Database: ", default="template1"))
conf.set("Destination", "user", prompt.query("Username: "))
pwd = getpass.getpass()
conf.set("Destination", "password", encrypt(pwd))
save_config(os.path.expanduser(conf_filename))