|
|
@ -4,6 +4,8 @@ from ...RedditVideoMakerBot.main import process, VERSION
|
|
|
|
|
|
|
|
|
|
|
|
# MAIN Group:
|
|
|
|
# MAIN Group:
|
|
|
|
# A group is created here called "main", which will have subcommands.
|
|
|
|
# A group is created here called "main", which will have subcommands.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@click.group()
|
|
|
|
@click.group()
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
# Since this command will execute nothing, we'll just pass.
|
|
|
|
# Since this command will execute nothing, we'll just pass.
|
|
|
@ -12,6 +14,8 @@ def main():
|
|
|
|
# Command 1:
|
|
|
|
# Command 1:
|
|
|
|
# We are using a decorator here, which is a "command" decorator, which turns your function into a command.
|
|
|
|
# We are using a decorator here, which is a "command" decorator, which turns your function into a command.
|
|
|
|
# Note that the decorator has an argument called "help", this will describe the command when we use "--help" flag
|
|
|
|
# Note that the decorator has an argument called "help", this will describe the command when we use "--help" flag
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@click.command(help="Create your reddit video.")
|
|
|
|
@click.command(help="Create your reddit video.")
|
|
|
|
def create():
|
|
|
|
def create():
|
|
|
|
# By making taking the help of "main.py", we import a function called "process" which does the same if we do "python main.py"
|
|
|
|
# By making taking the help of "main.py", we import a function called "process" which does the same if we do "python main.py"
|
|
|
@ -19,12 +23,16 @@ def create():
|
|
|
|
|
|
|
|
|
|
|
|
# Command 2:
|
|
|
|
# Command 2:
|
|
|
|
# We are using a decorator here, which is a "command" decorator, which turns your function into a command.
|
|
|
|
# We are using a decorator here, which is a "command" decorator, which turns your function into a command.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@click.command(help="Bot's version")
|
|
|
|
@click.command(help="Bot's version")
|
|
|
|
def version():
|
|
|
|
def version():
|
|
|
|
print(VERSION)
|
|
|
|
print(VERSION)
|
|
|
|
|
|
|
|
|
|
|
|
# Helper 1:
|
|
|
|
# Helper 1:
|
|
|
|
# This function takes the group, command and the name. After that it adds a command into that group
|
|
|
|
# This function takes the group, command and the name. After that it adds a command into that group
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def command_adder(group: click.Group, cmd: click.Command, name: str):
|
|
|
|
def command_adder(group: click.Group, cmd: click.Command, name: str):
|
|
|
|
# Adding command
|
|
|
|
# Adding command
|
|
|
|
group.add_command(cmd, name)
|
|
|
|
group.add_command(cmd, name)
|
|
|
|