mirror of
https://github.com/frappe/bench.git
synced 2024-11-13 16:56:33 +00:00
fix: Hit command cache before fetching all commands
This commit is contained in:
parent
d467cf54c1
commit
a94ea19bf4
18
bench/cli.py
18
bench/cli.py
@ -45,7 +45,11 @@ def cli():
|
||||
return old_frappe_cli()
|
||||
|
||||
elif len(sys.argv) > 1:
|
||||
if sys.argv[1] in get_frappe_commands() + ["--site", "--verbose", "--force", "--profile"]:
|
||||
if sys.argv[1] in ["--site", "--verbose", "--force", "--profile"]:
|
||||
return frappe_cmd()
|
||||
if sys.argv[1] in get_cached_frappe_commands():
|
||||
return frappe_cmd()
|
||||
if sys.argv[1] in get_frappe_commands():
|
||||
return frappe_cmd()
|
||||
|
||||
elif sys.argv[1] == "--help":
|
||||
@ -124,16 +128,16 @@ def frappe_cmd(bench_path='.'):
|
||||
os.execv(f, [f] + ['-m', 'frappe.utils.bench_helper', 'frappe'] + sys.argv[1:])
|
||||
|
||||
|
||||
def get_frappe_commands():
|
||||
if not is_bench_directory():
|
||||
return []
|
||||
|
||||
def get_cached_frappe_commands():
|
||||
if os.path.exists(bench_cache_file):
|
||||
command_dump = open(bench_cache_file, 'r').read() or '[]'
|
||||
return json.loads(command_dump)
|
||||
|
||||
else:
|
||||
return generate_command_cache()
|
||||
def get_frappe_commands():
|
||||
if not is_bench_directory():
|
||||
return []
|
||||
|
||||
return generate_command_cache()
|
||||
|
||||
|
||||
def get_frappe_help(bench_path='.'):
|
||||
|
Loading…
Reference in New Issue
Block a user