-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from crushingCodes/add-arguments-to-create
- Loading branch information
Showing
1 changed file
with
12 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
import click | ||
from keep import cli, utils | ||
|
||
@click.command('new', short_help='Saves a new command.') | ||
@click.command("new", short_help="Saves a new command.") | ||
@click.option("--cmd", help="The command to save") | ||
@click.option("--desc", help="The description of the command") | ||
@click.option("--alias", default="", help="The alias of the command") | ||
@cli.pass_context | ||
def cli(ctx): | ||
def cli(ctx, cmd, desc, alias): | ||
"""Saves a new command""" | ||
cmd = click.prompt('Command') | ||
desc = click.prompt('Description ') | ||
alias = click.prompt('Alias (optional)', default='') | ||
if not cmd: | ||
cmd = click.prompt("Command") | ||
if not desc: | ||
desc = click.prompt("Description") | ||
if not alias: | ||
alias = click.prompt("Alias (optional)", default="") | ||
utils.save_command(cmd, desc, alias) | ||
|
||
utils.log(ctx, 'Saved the new command - {} - with the description - {}.'.format(cmd, desc)) | ||
utils.log(ctx, "Saved the new command - {} - with the description - {}.".format(cmd, desc)) |