22Root CLI for modflow-devtools.
33
44Usage:
5+ mf sync
6+ mf dfns sync
7+ mf dfns info
8+ mf dfns list
9+ mf dfns clean
510 mf models sync
611 mf models info
712 mf models list
1722
1823import argparse
1924import sys
25+ import warnings
26+
27+
28+ def _sync_all ():
29+ """Sync all registries (dfns, models, programs)."""
30+ print ("Syncing all registries..." )
31+ print ()
32+
33+ # Sync DFNs
34+ print ("=== DFNs ===" )
35+ try :
36+ from modflow_devtools .dfns .registry import sync_dfns
37+
38+ registries = sync_dfns ()
39+ for registry in registries :
40+ meta = registry .registry_meta
41+ print (f" { registry .ref } : { len (meta .files )} files" )
42+ print (f"Synced { len (registries )} DFN registry(ies)" )
43+ except Exception as e :
44+ print (f"Error syncing DFNs: { e } " )
45+ print ()
46+
47+ # Sync Models
48+ print ("=== Models ===" )
49+ try :
50+ from modflow_devtools .models import ModelSourceConfig
51+
52+ config = ModelSourceConfig .load ()
53+ config .sync ()
54+ print ("Models synced successfully" )
55+ except Exception as e :
56+ print (f"Error syncing models: { e } " )
57+ print ()
58+
59+ # Sync Programs
60+ print ("=== Programs ===" )
61+ try :
62+ # Suppress experimental warning
63+ with warnings .catch_warnings ():
64+ warnings .filterwarnings ("ignore" , message = ".*modflow_devtools.programs.*experimental.*" )
65+ from modflow_devtools .programs import ProgramSourceConfig
66+
67+ config = ProgramSourceConfig .load ()
68+ config .sync ()
69+ print ("Programs synced successfully" )
70+ except Exception as e :
71+ print (f"Error syncing programs: { e } " )
72+ print ()
73+
74+ print ("All registries synced!" )
2075
2176
2277def main ():
@@ -27,6 +82,12 @@ def main():
2782 )
2883 subparsers = parser .add_subparsers (dest = "subcommand" , help = "Available commands" )
2984
85+ # Sync subcommand (syncs all APIs)
86+ subparsers .add_parser ("sync" , help = "Sync all registries (dfns, models, programs)" )
87+
88+ # DFNs subcommand
89+ subparsers .add_parser ("dfns" , help = "Manage MODFLOW 6 definition files" )
90+
3091 # Models subcommand
3192 subparsers .add_parser ("models" , help = "Manage MODFLOW model registries" )
3293
@@ -41,7 +102,14 @@ def main():
41102 sys .exit (1 )
42103
43104 # Dispatch to the appropriate module CLI with remaining args
44- if args .subcommand == "models" :
105+ if args .subcommand == "sync" :
106+ _sync_all ()
107+ elif args .subcommand == "dfns" :
108+ from modflow_devtools .dfns .__main__ import main as dfns_main
109+
110+ sys .argv = ["mf dfns" , * remaining ]
111+ sys .exit (dfns_main ())
112+ elif args .subcommand == "models" :
45113 from modflow_devtools .models .__main__ import main as models_main
46114
47115 # Replace sys.argv to make it look like we called the submodule directly
0 commit comments