Beispiel #1
0
def _stash_remove(cmd_key, title):
    commands = keep_utils.read_commands()
    if commands is not None and cmd_key in commands:
        keep_utils.remove_command(cmd_key)
        print(f'\n{BOLD}{GREEN}"{title}" removed from stash{END_FORMAT}\n')
    else:
        print(f'\n{BOLD}{RED}"{title}" not found in stash{END_FORMAT}\n')
Beispiel #2
0
def _stash_remove(cmd_key, title):
    commands = keep_utils.read_commands()
    if commands is not None and cmd_key in commands:
        keep_utils.remove_command(cmd_key)
        print('\n{bold}{green}"{title}" removed from stash.{end_format}\n'.
              format(bold=BOLD,
                     green=GREEN,
                     title=title,
                     end_format=END_FORMAT))
    else:
        print(
            '\n{bold}{red}"{title}" not found in stash.{end_format}\n'.format(
                bold=BOLD, red=RED, title=title, end_format=END_FORMAT))
Beispiel #3
0
def cli(ctx, pattern):
    """Deletes a saved command."""
    matches = utils.grep_commands(pattern)
    if matches:
        selected = utils.select_command(matches)
        if selected >= 0:
            cmd, desc = matches[selected]
            command = "$ {} :: {}".format(cmd, desc)
            if click.confirm("Remove\n\t{}\n\n?".format(command),
                             default=True):
                utils.remove_command(cmd)
                click.echo('Command successfully removed!')
    elif matches == []:
        click.echo('No saved commands matches the pattern {}'.format(pattern))
    else:
        click.echo("No commands to remove, Add one by 'keep new'. ")
Beispiel #4
0
def cli(ctx):
    """Deletes a saved command."""
    cmd = click.prompt('Command to remove')
    utils.remove_command(ctx, cmd)