Skip to content

Commit

Permalink
Merge pull request #92 from crushingCodes/add-arguments-to-create
Browse files Browse the repository at this point in the history
  • Loading branch information
rahuliyer95 authored May 20, 2023
2 parents 8dddc00 + 1ee0952 commit e6eadb9
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions keep/commands/cmd_new.py
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))

0 comments on commit e6eadb9

Please sign in to comment.