Skip to content

Commit 1d6ba12

Browse files
committed
Add option to set system properties from command-line
1 parent 6afafc5 commit 1d6ba12

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1111

1212
- ![SOURCE] Add source from Swiss Federal Statistical Office [#1132](https://github.com/nbbrd/sdmx-dl/issues/1132)
1313
- ![GRPC] Add simple web page to query rest web service
14+
- ![CLI] Add option to set system properties from command-line
1415

1516
### Fixed
1617

sdmx-dl-cli/src/main/java/sdmxdl/cli/MainCommand.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import sdmxdl.About;
2727
import sdmxdl.cli.experimental.DebugCommand;
2828

29+
import java.util.Map;
2930
import java.util.Properties;
3031
import java.util.concurrent.Callable;
3132

@@ -63,7 +64,7 @@ public static void main(String[] args) {
6364

6465
LoggerHelper.disableDefaultConsoleLogger();
6566
KeychainStoreIgnoredExceptionFix.register();
66-
67+
6768
System.exit(execMain(specialProperties, System.getProperties(), args));
6869
}
6970

@@ -79,6 +80,15 @@ private static int execMain(SpecialProperties specialProperties, Properties prop
7980
}
8081
}
8182

83+
@CommandLine.Option(
84+
names = "-D",
85+
mapFallbackValue = "", // allow -Dkey
86+
hidden = true,
87+
scope = CommandLine.ScopeType.INHERIT)
88+
void setProperty(Map<String, String> props) {
89+
props.forEach(System::setProperty);
90+
}
91+
8292
@CommandLine.Spec
8393
private CommandLine.Model.CommandSpec spec;
8494

0 commit comments

Comments
 (0)