Method: flask.cli.FlaskGroup.list_commands
Calls: 3, Exceptions: 3, Paths: 2Back
Path 1: 2 calls (0.67)
Context (2)
['routes', 'run', 'shell'] (2)
NoAppException (2)
1def list_commands(self, ctx):
2 self._load_plugin_commands()
3 # Start with the built-in and plugin commands.
4 rv = set(super().list_commands(ctx))
5 info = ctx.ensure_object(ScriptInfo)
6
7 # Add commands provided by the app, showing an error and
8 # continuing if the app couldn't be loaded.
9 try:
10 rv.update(info.load_app().cli.list_commands(ctx))
11 except NoAppException as e:
12 # When an app couldn't be loaded, show the error message
13 # without the traceback.
14 click.secho(f"Error: {e.format_message()}\n", err=True, fg="red")
15 except Exception:
16 # When any other errors occurred during loading, show the
17 # full traceback.
18 click.secho(f"{traceback.format_exc()}\n", err=True, fg="red")
19
20 return sorted(rv)
Path 2: 1 calls (0.33)
Context (1)
['routes', 'run', 'shell'] (1)
Exception (1)
1def list_commands(self, ctx):
2 self._load_plugin_commands()
3 # Start with the built-in and plugin commands.
4 rv = set(super().list_commands(ctx))
5 info = ctx.ensure_object(ScriptInfo)
6
7 # Add commands provided by the app, showing an error and
8 # continuing if the app couldn't be loaded.
9 try:
10 rv.update(info.load_app().cli.list_commands(ctx))
11 except NoAppException as e:
12 # When an app couldn't be loaded, show the error message
13 # without the traceback.
14 click.secho(f"Error: {e.format_message()}\n", err=True, fg="red")
15 except Exception:
16 # When any other errors occurred during loading, show the
17 # full traceback.
18 click.secho(f"{traceback.format_exc()}\n", err=True, fg="red")
19
20 return sorted(rv)