You can build your own decorator that encapsulates the common options:

def common_options(function):
    function = click.option('--unique-flag-1', is_flag=True)(function)
    function = click.option('--bar', is_flag=True)(function)
    function = click.option('--foo', is_flag=True)(function)
    return function

@click.command()
@common_options
def command():
    pass
Answer from Will Vousden on Stack Overflow
🌐
Stack Overflow
stackoverflow.com › questions › 73594892 › python-click-reuse-click-options-from-group-in-command
How to reuse options from groups to command in Python Click? - Stack Overflow
2 Using click.CommandCollection drops group options · 9 Get params sent to a subcommand of a click.group() ... 2 Python Click options - Avoid taking multiple times the same option if the parameter multiple is not passed
🌐
Readthedocs
pocoo-click.readthedocs.io › en › latest › options
Options - the Click Documentation
@click.command() @click.option('--username', prompt=True, default=lambda: os.environ.get('USER', '')) def hello(username): print("Hello,", username) Sometimes, you want a parameter to completely change the execution flow. For instance, this is the case when you want to have a --version parameter that prints out the version and then exits the application. Note: an actual implementation of a --version parameter that is reusable is available in Click as click.version_option().
🌐
Jeff Triplett
jefftriplett.com › 2016 › reusable-click-options
Reusable Click Options | Jeff Triplett
February 17, 2016 - Click options are reusable. I’m not sure why I never thought of this before but it’s handy if you are writing dozens of click commands and you reuse the same options over and over.
🌐
Click Documentation
click.palletsprojects.com › en › stable › advanced
Advanced Patterns — Click Documentation (8.5.x)
Note: an actual implementation of a --version parameter that is reusable is available in Click as click.version_option().
🌐
Click Documentation
click.palletsprojects.com › en › stable › options
Options — Click Documentation (8.5.x)
The substitution rule above resolves it to that option’s flag_value. Any other explicit default is passed through literally. The third row is the three-state pattern: the function receives None when no flag is passed, distinguishable from either explicit choice. When flag_value is True or False, the substitution rule does not apply: default=True is the literal Python True. To make one flag in an enable/disable pair the default, set its default=True explicitly: @click.option("--without-xyz", "enable_xyz", flag_value=False) @click.option("--with-xyz", "enable_xyz", flag_value=True, default=True)
🌐
GitHub
github.com › pallets › click › discussions › 2978
Reusing options at different commands · pallets/click · Discussion #2978
June 17, 2025 - Assign the decorator produced by click.option to a name, then use that name as the decorator in multiple places. This is not specific to Click, you could do this with any function that produces a decorator in Python.
Author: pallets
🌐
Prodevsblog
prodevsblog.com › questions › 115737 › is-it-possible-to-reuse-python-click-option-decorators-for-multiple-commands
Q&A ProDevsBlog | Is it possible to reuse python @click.option decorators for multiple commands?
July 26, 2020 - def common_options(function): function = click.option('--unique-flag-1', is_flag=True)(function) function = click.option('--bar', is_flag=True)(function) function = click.option('--foo', is_flag=True)(function) return function @click.command() @common_options def command(): pass
Find elsewhere
Top answer
1 of 1
16

The way you currently defined it it will work, but the --verbose option belongs to the main command group, so you'd need to call it as python script.py --verbose list (and my_find_command and my_list_command won't receive it as an argument, only cli).

To use the same option across multiple commands without repeating yourself too much, you can just assign it to a variable and then use it twice:

verbose_option = click.option(
    "-v",
    "--verbose",
    count=True,
    default=0,
    help="-v for DEBUG",
)

...

@click.command()
@verbose_option
def foo(verbose):
    ...

@click.command()
@verbose_option
def bar(verbose):
    ...

Unrelated, but while we're at it: There's a simpler way of grouping commands, without having to do cli.add_command(my_find_command): Just use @cli.command() instead of @click.command():

import click

option_verbose = click.option(
    "-v",
    "--verbose",
    count=True,
    default=0,
    help="-v for DEBUG",
)

@click.group()
def cli():
    pass


@cli.command("list")
@option_verbose
@click.option(
    "--list-option",
    help="Special option for list command.",
)
def my_list_command(verbose, list_option):
    print(verbose, list_option)

@cli.command("find")
@option_verbose
@click.option(
    "--find-option",
    help="Special option for find command.",
)
def my_find_command(verbose, list_option):
    print(verbose, list_option)

if __name__ == '__main__':
    cli()

If there's several options you want to apply, you can define your own decorator that calls all those options on the argument:

def common_options(fn):
    return click.option(
        "-v",
        "--verbose",
    )(
        click.option(
            "-n",
            "--dry-run",
        )(fn)
    )
🌐
Better Stack
betterstack.com › community › guides › scaling-python › click-explained
Creating composable CLIs with click in Python | Better Stack Community
Click is a powerful and flexible Python framework for building command-line interfaces (CLI). It simplifies development with command nesting, parameter validation, and automatic help text generation, making CLI applications more intuitive and maintainable. This article covers the fundamentals of Click and demonstrates how to build a modular, reusable ...
🌐
GitHub
github.com › pallets › click › issues › 926
Option instance reuse with custom `cls` impossible · Issue #926 · pallets/click
February 8, 2018 - Let's say I pre-define an option meant for multiple commands: opt = click.option('opt', cls=CustomOption) @opt def cmd1(opt): pass @opt def cmd2(opt): pass This will (click 6.7, and latest master when this issue was created) cause the cl...
Author: pallets
🌐
ZetCode
zetcode.com › python › click
Python click - creating command line interfaces
January 29, 2024 - Options are added to commands with the click.option decorator. Option names are prefixed with one or two dashes. ... #!/usr/bin/python import click @click.command() @click.option('--n', type=int, default=1) def dots(n): click.echo('.' * n) if __name__ == '__main__': dots()
🌐
Devnet-academy
docs.devnet-academy.com › docs › click_v7.1.2 › options.html
Options — Click Documentation (7.x)
$ hello --help Usage: hello [OPTIONS] Options: --username TEXT [default: (current user)] --help Show this message and exit. Sometimes, you want a parameter to completely change the execution flow. For instance, this is the case when you want to have a --version parameter that prints out the version and then exits the application. Note: an actual implementation of a --version parameter that is reusable is available in Click as click.version_option().
🌐
CSDN
devpress.csdn.net › python › 630455a0c67703293080b588.html
Is it possible to reuse python @click.option decorators for multiple commands?_python_Mangs-Python
@click.command() @click.option('--foo', is_flag=True) @click.option('--bar', is_flag=True) @click.option('--unique-flag-1', is_flag=True) def command_one(): pass @click.command() @click.option('--foo', is_flag=True) @click.option('--bar', is_flag=True) @click.option('--unique-flag-2', is_flag=True) def command_two(): pass · Is it possible to extract the common options in to a single decorator that can be applied to each function?
🌐
GitHub
github.com › pallets › click › issues › 330
How can I reuse the function that iv made as a command? · Issue #330 · pallets/click
April 22, 2015 - i have the following code: pass_config = click.make_pass_decorator(Config, ensure=True) @click.group() init(config): pass @init.group() @pass_config def a(config): pass @a.command('print') @pass_config def print_a(config): print "yes" @i...
Author: pallets
🌐
GitHub
github.com › click-contrib › click-option-group › issues › 27
Modularization of OptionGroups from the Group/Command/MultiCommand · Issue #27 · click-contrib/click-option-group
March 17, 2021 - In click it's possible to split the cli entry point function into several modules/files with the following sample: from .subcommand1 import subcommand1 @click.group('...') @click.pass_context def main(ctx): """The main entry point for th...
Author: click-contrib
🌐
Click Documentation
click.palletsprojects.com › en › stable › documentation
Help Pages — Click Documentation (8.5.x)
Help parameters are automatically added by Click for any command. The default is --help but can be overridden by the context setting help_option_names. Click resolves conflicts automatically: an option reusing one of the help option names takes it over, and the default help parameter is dropped ...