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
🌐
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.
Discussions

How to define common python-click options for multiple commands? - Stack Overflow
I also tried to use @click.pass_context but that does not seem to solev the issue. ... 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 ... More on stackoverflow.com
🌐 stackoverflow.com
Reusing options at different commands
Long ago I used click and I got frustrated how I can't reuse code. I then contrived a method where I could define options at a central place and then reuse it but it felt like a hack. I wonder ... More on github.com
🌐 github.com
1
1
June 17, 2025
python - Shared options and flags between commands - Stack Overflow
Error: No such option: --verbose · Don't forget that using @ for decorators in python is just a syntactic shortcut for an explicit call to the decorator, passing the function as the first parameter and returning another function. You can just assign that function to a variable, and click allows you to reuse ... More on stackoverflow.com
🌐 stackoverflow.com
Option instance reuse with custom `cls` impossible
This will (click 6.7, and latest master when this issue was created) cause the cls parameter to be popped from **attrs – which is shared between all calls of the inner decorator, because of the closure – in the first call, leading to a broken option in the second call. More on github.com
🌐 github.com
2
February 8, 2018
🌐
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().
🌐
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)
🌐
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)
    )
🌐
ProgramCreek
programcreek.com › python › example › 88019 › click.Option
Python Examples of click.Option
def cli_option_traceback(func): ... reusable CLI option `--traceback`.""" # noinspection PyUnusedLocal def _callback(ctx: click.Context, param: click.Option, value: bool): ctx_obj = ctx.ensure_object(dict) if ctx_obj is not None: ctx_obj["traceback"] = value return value return click.option( '--traceback', is_flag=True, help="Enable tracing back errors by dumping the Python call ...
🌐
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
🌐
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
🌐
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?
🌐
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().
🌐
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
🌐
dbader.org
dbader.org › blog › mastering-click-advanced-python-command-line-apps
Mastering Click: Writing Advanced Python Command-Line Apps – dbader.org
January 2, 2018 - The most obvious ones are the builtin Python types such as str, int, float but Click also provides additional types: Path, File and more. The complete list is available in the section on Parameter Types. Ensuring that an input value is of a specific type is as easy as you can make it. You simply pass the parameter type you’re expecting to the decorator as type argument when defining your parameter. Something like this: @click.option('--api-key', '-a', type=str) @click.option('--config-file', '-c', type=click.Path())