Skip to content

group return value is ignored #2124

@arthaud

Description

@arthaud

Calling a command defined as @click.group() with standalone_mode=False does not propagate the return value as expected.

For instance:

import click
import sys

@click.group(invoke_without_command=True)
@click.option("-l", "--local-configuration", type=str)
def main(local_configuration):
    print('Inside main')
    return 1

if __name__ == '__main__':
    print(main(sys.argv[1:], standalone_mode=False))
$ python test.py
Inside main
None

It does work when the command is defined with @click.command(), hence I suppose this is a bug.

Environment:

  • Python version: 3.7.5
  • Click version: 8.0.3

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions