package io.github.interestinglab.waterdrop.config;


import java.io.File;
import java.util.Map;

public class ExposeSparkDriverConf {

    public static void main(String[] args) throws Exception {
        Config appConfig = ConfigFactory.parseFile(new File(args[0]))
                .resolve(ConfigResolveOptions.defaults().setAllowUnresolved(true))
                .resolveWith(ConfigFactory.systemProperties(), ConfigResolveOptions.defaults().setAllowUnresolved(true));

        String driverPrefix = "spark.driver.";
        Config sparkConfig = appConfig.getConfig("spark");

        if (!TypesafeConfigUtils.hasSubConfig(sparkConfig, driverPrefix)) {
            System.out.println("");
        } else {
            Config sparkDriverConfig = TypesafeConfigUtils.extractSubConfig(sparkConfig, driverPrefix, false);
            StringBuilder stringBuilder = new StringBuilder();
            for (Map.Entry<String, ConfigValue> entry: sparkDriverConfig.entrySet()) {
                String conf = String.format(" --driver-%s=%s ", entry.getKey(), entry.getValue().unwrapped());
                stringBuilder.append(conf);
            }

            System.out.println(stringBuilder.toString());
        }
//        appConfig.getConfig("spark").entrySet()
//        for (Map.Entry<String, ConfigValue> entry: appConfig.getConfig("spark").entrySet()) {
//            String conf = String.format(" --conf \"%s=%s\" ", entry.getKey(), entry.getValue().unwrapped());
//            stringBuilder.append(conf);
//        }
//
//        System.out.print(stringBuilder.toString());
    }
}

@@ -1205,376 +1205,8 @@
   %7D%0A
-//        appConfig.getConfig(%22spark%22).entrySet()%0A//        for (Map.Entry%3CString, ConfigValue%3E entry: appConfig.getConfig(%22spark%22).entrySet()) %7B%0A//            String conf = String.format(%22 --conf %5C%22%25s=%25s%5C%22 %22, entry.getKey(), entry.getValue().unwrapped());%0A//            stringBuilder.append(conf);%0A//        %7D%0A//%0A//        System.out.print(stringBuilder.toString());%0A
     

Remove useless code