r""" Helpers tasks for the shell mode. """ import os import sys from ec.ec import task, module from state import Settings import core from helpers import err, getRouteHelp module(desc='Shell mode Tasks.') # Tasks @task(alias='c', desc='Clears the console.') def clear(): r"""Clears the console. """ os.system('cls' if os.name == 'nt' else 'clear') @task(alias='h', desc='Displays help on the available tasks and groups.') def help(route): r"""Displays help for the given route. Args: route (str): A route that resolves a member. """ help_text = getRouteHelp(route.split('/') if route else []) if help_text is None:
@task def wrapper(): """Calls nut_shell.simple with some arguments, the args that aren't provided will be collected. """ call(simple, arg1=1, arg2=2) @task def get(): """Get user input through utils.get. """ print get(desc='Email id', type=regex.email) def log(message): """A helper method. """ print message name = 'intro' # Groups could even have variables. # importing other modules import simple member(simple) # member() is used to expose imported members as the children of the current module @exit_hook def clean_up(): # exit hooks are called when ec exits. There may be more than one hook. print ':)' module(desc='A module to test decorator based configuration.') # module is an optional call, used to configure the group that wraps current module. settings(dev_mode=True) # settings for ec