Bird
0
0

Given this Flask CLI command code, what will be printed when running flask greet?

medium📝 component behavior Q13 of 15
Flask - Ecosystem and Patterns
Given this Flask CLI command code, what will be printed when running flask greet?
import click
from flask import Flask
app = Flask(__name__)

@app.cli.command()
@click.argument('name')
def greet(name):
    click.echo(f'Hello, {name}!')
AHello, name!
BHello, <name>!
CHello, None!
DError: Missing argument 'name'
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the command definition

    The command greet requires a positional argument name due to @click.argument('name').
  2. Step 2: Check the command usage

    Running flask greet without providing name will cause Click to raise an error about the missing argument.
  3. Final Answer:

    Error: Missing argument 'name' -> Option D
  4. Quick Check:

    Missing required argument causes error [OK]
Quick Trick: Provide all required arguments to avoid errors [OK]
Common Mistakes:
MISTAKES
  • Assuming default values for arguments
  • Expecting 'name' to print literally
  • Ignoring Click argument requirements

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes