Exemplo n.º 1
0
def delete_var(args, flags):
    if args[0] in substitutes:
        v = substitutes[args[0]]
        del(substitutes[args[0]])
        dump_subs()
        return "The variable {var}, set to {val}, has been deleted and will no longer substitute into commands." + \
               "Set the variable again with `set {var} <new value>'".format(var=args[0], value=v)
    return "No variable could be found with that name {name}.".format(name=args[0])

# TODO maybe a flag to make the command not substitute variables would be cool?
Exemplo n.º 2
0
def set(args, flags):
    substitutes[args[0]] = [' '.join(args[1:]), 'm' in flags]
    dump_subs()
    return ("{var} has been set to {x}{val}{x}".format(var=args[0], x="" if 'm' in flags else '"',
                                                     val=' '.join(args[1:])))