Add argument and option#
Open your command file scli/commands/your_command.py
and paste below code.
# scli/commands/your_command.py
from scli.commands.base import BaseCommand
from scli.utils import argument
from scli.utils import option
class Command(BaseCommand):
name = "your_command"
description = "A simple description"
help = """
A useful help message
"""
arguments = [
argument(
name="name",
description="Argument name",
),
]
options = [
option(
long_name="create",
short_name="c",
description="Check option",
flag=True,
)
]
def handle(self):
name = self.argument("name")
check = self.option("create")
if check:
self.comment("User with name {} created.".format(name))
else:
self.comment("User with name {} doesn't created.".format(name))
Command
Output