@@ -1927,6 +1927,8 @@ static void PrintUsage(const char* app_name) {
19271927 Dmod_Printf (" -m, --manifest <path> Path or URL to manifest file\n" );
19281928 Dmod_Printf (" -o, --output-dir <path> Output directory for downloaded modules\n" );
19291929 Dmod_Printf (" --config-dir <path> Directory where configuration files should be copied\n" );
1930+ Dmod_Printf (" --config <path> Configuration file to copy (for single module only)\n" );
1931+ Dmod_Printf (" --config-dest <name> Custom destination filename for config file\n" );
19301932 Dmod_Printf (" -D, --define <VAR=value> Define variable for config path substitution\n" );
19311933 Dmod_Printf (" -t, --tools-name <name> Tools name for variable substitution\n" );
19321934 Dmod_Printf (" -a, --arch-name <name> Architecture name for variable substitution\n" );
@@ -1963,6 +1965,8 @@ static void PrintUsage(const char* app_name) {
19631965 Dmod_Printf (" %s -d deps.dmd # Download all modules from deps.dmd\n" , app_name );
19641966 Dmod_Printf (" %s -d deps.dmd --config-dir ./config # Download modules and copy configs to ./config\n" , app_name );
19651967 Dmod_Printf (" %s -d deps.dmd --config-dir ./config -D BOARD=stm32f7 # Use variable substitution in config paths\n" , app_name );
1968+ Dmod_Printf (" %s dmclk@0.4 --config board/stm32f746g-disco.ini --config-dir ./config # Download module with config\n" , app_name );
1969+ Dmod_Printf (" %s mymodule --config mcu/config.ini --config-dir ./cfg --config-dest my.ini # Custom config destination\n" , app_name );
19661970 Dmod_Printf (" %s -m http://... module # Use custom manifest\n" , app_name );
19671971 Dmod_Printf (" %s --type dmfc module # Prefer dmfc files\n" , app_name );
19681972 Dmod_Printf (" %s -a armv7-cortex-m7 module # Use arch name directly\n" , app_name );
@@ -2332,6 +2336,8 @@ int main(int argc, char* argv[]) {
23322336 const char * manifest_path = NULL ;
23332337 const char * output_dir = NULL ;
23342338 const char * config_dir = NULL ;
2339+ const char * config_file = NULL ; // Configuration file to copy for single module
2340+ const char * config_dest_name = NULL ; // Custom destination name for config file
23352341 const char * tools_name = NULL ;
23362342 const char * arch_name = NULL ;
23372343 const char * cpu_name = NULL ;
@@ -2385,6 +2391,20 @@ int main(int argc, char* argv[]) {
23852391 }
23862392 config_dir = argv [i ];
23872393 }
2394+ else if (strcmp (argv [i ], "--config" ) == 0 ) {
2395+ if (++ i >= argc ) {
2396+ DMOD_LOG_ERROR ("Error: %s requires an argument\n" , argv [i - 1 ]);
2397+ return 1 ;
2398+ }
2399+ config_file = argv [i ];
2400+ }
2401+ else if (strcmp (argv [i ], "--config-dest" ) == 0 ) {
2402+ if (++ i >= argc ) {
2403+ DMOD_LOG_ERROR ("Error: %s requires an argument\n" , argv [i - 1 ]);
2404+ return 1 ;
2405+ }
2406+ config_dest_name = argv [i ];
2407+ }
23882408 else if (strcmp (argv [i ], "-D" ) == 0 || strcmp (argv [i ], "--define" ) == 0 ) {
23892409 if (++ i >= argc ) {
23902410 DMOD_LOG_ERROR ("Error: %s requires an argument\n" , argv [i - 1 ]);
@@ -2532,6 +2552,32 @@ int main(int argc, char* argv[]) {
25322552 return 1 ;
25332553 }
25342554
2555+ // Validate --config option usage
2556+ if (config_file ) {
2557+ if (!config_dir ) {
2558+ DMOD_LOG_ERROR ("Error: --config requires --config-dir to be specified\n" );
2559+ PrintUsage (argv [0 ]);
2560+ return 1 ;
2561+ }
2562+ if (dependencies_path ) {
2563+ DMOD_LOG_ERROR ("Error: --config cannot be used with -d/--dependencies\n" );
2564+ DMOD_LOG_ERROR (" Use configuration syntax in .dmd file instead\n" );
2565+ PrintUsage (argv [0 ]);
2566+ return 1 ;
2567+ }
2568+ if (command && (strcmp (command , "headers" ) == 0 || strcmp (command , "docs" ) == 0 )) {
2569+ DMOD_LOG_ERROR ("Error: --config cannot be used with %s command\n" , command );
2570+ PrintUsage (argv [0 ]);
2571+ return 1 ;
2572+ }
2573+ }
2574+
2575+ if (config_dest_name && !config_file ) {
2576+ DMOD_LOG_ERROR ("Error: --config-dest requires --config to be specified\n" );
2577+ PrintUsage (argv [0 ]);
2578+ return 1 ;
2579+ }
2580+
25352581 // Initialize curl
25362582 curl_global_init (CURL_GLOBAL_DEFAULT );
25372583
@@ -2930,6 +2976,12 @@ int main(int argc, char* argv[]) {
29302976
29312977 if (result != 0 ) {
29322978 counts .failed_count ++ ;
2979+ } else if (config_file && config_dir ) {
2980+ // If configuration file is specified via command line, copy it
2981+ DMOD_LOG_INFO ("Configuration file specified: %s\n" , config_file );
2982+ if (!CopyConfigurationFile (module_name , config_file , output_dir , config_dir , config_dest_name )) {
2983+ DMOD_LOG_WARN ("Failed to copy configuration file (module was installed successfully)\n" );
2984+ }
29332985 }
29342986
29352987 // Print installation summary
0 commit comments