mirror of
https://github.com/frappe/bench.git
synced 2025-01-11 01:32:07 +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()
|
return old_frappe_cli()
|
||||||
|
|
||||||
elif len(sys.argv) > 1:
|
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()
|
return frappe_cmd()
|
||||||
|
|
||||||
elif sys.argv[1] == "--help":
|
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:])
|
os.execv(f, [f] + ['-m', 'frappe.utils.bench_helper', 'frappe'] + sys.argv[1:])
|
||||||
|
|
||||||
|
|
||||||
def get_frappe_commands():
|
def get_cached_frappe_commands():
|
||||||
if not is_bench_directory():
|
|
||||||
return []
|
|
||||||
|
|
||||||
if os.path.exists(bench_cache_file):
|
if os.path.exists(bench_cache_file):
|
||||||
command_dump = open(bench_cache_file, 'r').read() or '[]'
|
command_dump = open(bench_cache_file, 'r').read() or '[]'
|
||||||
return json.loads(command_dump)
|
return json.loads(command_dump)
|
||||||
|
|
||||||
else:
|
def get_frappe_commands():
|
||||||
return generate_command_cache()
|
if not is_bench_directory():
|
||||||
|
return []
|
||||||
|
|
||||||
|
return generate_command_cache()
|
||||||
|
|
||||||
|
|
||||||
def get_frappe_help(bench_path='.'):
|
def get_frappe_help(bench_path='.'):
|
||||||
|
Loading…
Reference in New Issue
Block a user