mirror of
https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
synced 2026-02-11 02:05:56 +01:00
Add version parameter
This commit is contained in:
@@ -2,6 +2,7 @@ package at.pcgamingfreaks.mkvaudiosubtitlechanger.config;
|
||||
|
||||
import at.pcgamingfreaks.mkvaudiosubtitlechanger.model.AttributeConfig;
|
||||
import at.pcgamingfreaks.mkvaudiosubtitlechanger.model.MkvToolNix;
|
||||
import at.pcgamingfreaks.mkvaudiosubtitlechanger.util.VersionUtil;
|
||||
import at.pcgamingfreaks.yaml.YAML;
|
||||
import at.pcgamingfreaks.yaml.YamlInvalidContentException;
|
||||
import lombok.AccessLevel;
|
||||
@@ -75,6 +76,7 @@ public class Config {
|
||||
}
|
||||
|
||||
exitIfHelp(cmd, options);
|
||||
exitIfVersion(cmd);
|
||||
|
||||
configPath = loadConfigPath(cmd, errors);
|
||||
libraryPath = loadLibraryPath(cmd, errors);
|
||||
@@ -101,6 +103,7 @@ public class Config {
|
||||
private static Options initOptions() {
|
||||
Options options = new Options();
|
||||
options.addOption(optionOf(HELP, "h", false));
|
||||
options.addOption(optionOf(VERSION, "v", false));
|
||||
options.addOption(optionOf(LIBRARY, "l", true));
|
||||
options.addOption(optionOf(MKV_TOOL_NIX, "m", true));
|
||||
options.addOption(optionOf(CONFIG_PATH, "c", true));
|
||||
@@ -121,6 +124,13 @@ public class Config {
|
||||
}
|
||||
}
|
||||
|
||||
private void exitIfVersion(CommandLine cmd) {
|
||||
if (cmd.hasOption(VERSION.prop())) {
|
||||
System.out.printf("MKV Audio Subtitle Changer Version %s%n", VersionUtil.getVersion());
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
private File loadConfigPath(CommandLine cmd, ConfigErrors errors) {
|
||||
File configPath = new File(cmd.getOptionValue(CONFIG_PATH.prop(), "config.yaml"));
|
||||
if (configPath.isFile()) return configPath;
|
||||
|
||||
Reference in New Issue
Block a user