Skip to content

Commit

Permalink
fix: Add support for options on bench main group
Browse files Browse the repository at this point in the history
Options like --use-feature, --version are tested and support maintained
by the changes defined in this commit
  • Loading branch information
gavindsouza committed Jul 27, 2022
1 parent a6f1964 commit 8a0b784
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions bench/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,31 @@ def cli():
):
log("Command not being executed in bench directory", level=3)

if in_bench and len(sys.argv) > 1:
if sys.argv[1] == "--help":
print(click.Context(bench_command).get_help())
if len(sys.argv) == 1 or sys.argv[1] == "--help":
print(click.Context(bench_command).get_help())
if in_bench:
print(get_frappe_help())
return
return

_opts = [x.opts + x.secondary_opts for x in bench_command.params]
opts = {item for sublist in _opts for item in sublist}

# handle usages like `--use-feature='feat-x'` and `--use-feature 'feat-x'`
if cmd_from_sys and cmd_from_sys.split("=", 1)[0].strip() in opts:
bench_command()

if cmd_from_sys in bench_command.commands:
with execute_cmd(check_for_update=not is_cli_command, command=command, logger=logger):
bench_command()
elif cmd_from_sys in get_frappe_commands():
if cmd_from_sys in bench_command.commands:
with execute_cmd(check_for_update=not is_cli_command, command=command, logger=logger):
bench_command()

if in_bench:
if cmd_from_sys in get_frappe_commands():
frappe_cmd()
else:
app_cmd()

bench_command()


def check_uid():
if cmd_requires_root() and not is_root():
Expand Down

0 comments on commit 8a0b784

Please sign in to comment.