Recall & Review
beginner
What is the Command pattern in the context of Flask CLI?
The Command pattern organizes code into separate commands that can be run from the command line using Flask CLI. Each command is a small, focused task you can run easily.
Click to reveal answer
beginner
How do you create a custom command in Flask CLI?
You create a function decorated with @app.cli.command(). This function runs when you type the command name in the terminal.
Click to reveal answer
intermediate
Why use the Command pattern with Flask CLI?
It helps keep your code clean by separating tasks like database setup, testing, or data import into easy-to-run commands.Click to reveal answer
intermediate
What decorator is used to add arguments to a Flask CLI command?
You use @click.argument or @click.option decorators to add arguments or options to your command functions.
Click to reveal answer
beginner
How does Flask CLI find and run your custom commands?
Flask CLI looks for functions decorated with @app.cli.command() in your app code and makes them available as commands you can run in the terminal.
Click to reveal answer
Which decorator do you use to create a new Flask CLI command?
✗ Incorrect
Use @app.cli.command() to define a new CLI command in Flask.
What Python package does Flask CLI use under the hood for command line parsing?
✗ Incorrect
Flask CLI uses the 'click' package to handle command line arguments and options.
How do you add an argument to a Flask CLI command?
✗ Incorrect
Arguments are added with the @click.argument() decorator.
What is the main benefit of using the Command pattern with Flask CLI?
✗ Incorrect
The Command pattern helps organize command line tasks into clear, reusable commands.
Which command runs your Flask CLI commands?
✗ Incorrect
You run custom commands with 'flask ' in the terminal.
Explain how to create and run a custom command using Flask CLI.
Think about how Flask CLI connects your Python function to a terminal command.
You got /3 concepts.
Describe the advantages of using the Command pattern in Flask CLI for your projects.
Consider how breaking tasks into commands helps in real-life project work.
You got /4 concepts.