mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[V3] added --version flag (#1479)
This commit is contained in:
parent
d65f8856f4
commit
10012c1e16
@ -96,15 +96,18 @@ def list_instances():
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
description = "Red - Version {}".format(__version__)
|
||||||
cli_flags = parse_cli_flags(sys.argv[1:])
|
cli_flags = parse_cli_flags(sys.argv[1:])
|
||||||
if cli_flags.list_instances:
|
if cli_flags.list_instances:
|
||||||
list_instances()
|
list_instances()
|
||||||
|
elif cli_flags.version:
|
||||||
|
print(description)
|
||||||
|
sys.exit(0)
|
||||||
elif not cli_flags.instance_name:
|
elif not cli_flags.instance_name:
|
||||||
print("Error: No instance name was provided!")
|
print("Error: No instance name was provided!")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
load_basic_configuration(cli_flags.instance_name)
|
load_basic_configuration(cli_flags.instance_name)
|
||||||
log, sentry_log = init_loggers(cli_flags)
|
log, sentry_log = init_loggers(cli_flags)
|
||||||
description = "Red - Version {}".format(__version__)
|
|
||||||
red = Red(cli_flags, description=description, pm_help=None)
|
red = Red(cli_flags, description=description, pm_help=None)
|
||||||
init_global_checks(red)
|
init_global_checks(red)
|
||||||
init_events(red, cli_flags)
|
init_events(red, cli_flags)
|
||||||
|
|||||||
@ -64,6 +64,8 @@ def ask_sentry(red: Red):
|
|||||||
def parse_cli_flags(args):
|
def parse_cli_flags(args):
|
||||||
parser = argparse.ArgumentParser(description="Red - Discord Bot",
|
parser = argparse.ArgumentParser(description="Red - Discord Bot",
|
||||||
usage="redbot <instance_name> [arguments]")
|
usage="redbot <instance_name> [arguments]")
|
||||||
|
parser.add_argument("--version", "-V", action="store_true",
|
||||||
|
help="Show Red's current version")
|
||||||
parser.add_argument("--list-instances", action="store_true",
|
parser.add_argument("--list-instances", action="store_true",
|
||||||
help="List all instance names setup "
|
help="List all instance names setup "
|
||||||
"with 'redbot-setup'")
|
"with 'redbot-setup'")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user