File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change
1
+ import inspect
1
2
import os
2
3
import re
3
4
import shutil
@@ -32,6 +33,27 @@ def exec_command(
32
33
):
33
34
extra_args = extra_args or []
34
35
cli_manager = CLIManager ()
36
+ for group in cli_manager .app .registered_groups :
37
+ if group .name == command :
38
+ for command_ in group .typer_instance .registered_commands :
39
+ if command_ .name == sub_command :
40
+ if "network" in inspect .getcallargs (
41
+ command_ .callback
42
+ ).keys () and not any (
43
+ (
44
+ x in extra_args
45
+ for x in (
46
+ "--network" ,
47
+ "--chain" ,
48
+ "--subtensor.network" ,
49
+ "--subtensor.chain_endpoint" ,
50
+ )
51
+ )
52
+ ):
53
+ # Ensure if we forget to add `--network ws://127.0.0.1:9945` that it will run still
54
+ # using the local chain
55
+ extra_args .extend (["--network" , "ws://127.0.0.1:9945" ])
56
+
35
57
# Capture stderr separately from stdout
36
58
runner = CliRunner (mix_stderr = False )
37
59
# Prepare the command arguments
You can’t perform that action at this time.
0 commit comments