Improve command description

This commit is contained in:
RatzzFatzz
2024-11-22 00:44:02 +01:00
parent 939f6053dd
commit b638d93358
2 changed files with 26 additions and 22 deletions

View File

@@ -17,7 +17,16 @@ import picocli.CommandLine;
import java.util.Set; import java.util.Set;
@Slf4j @Slf4j
@CommandLine.Command(mixinStandardHelpOptions = true, versionProvider = ProjectUtil.class) @CommandLine.Command(
name = "mkvasc",
usageHelpWidth = 120,
customSynopsis = {
"mkvasc -a <attributeConfig>... -l <libraryPath> [-s]",
"Example: mkvasc -a eng:eng eng:ger -l /mnt/media/ -s"
},
mixinStandardHelpOptions = true,
versionProvider = ProjectUtil.class
)
public class Main implements Runnable { public class Main implements Runnable {
@Getter @Getter

View File

@@ -29,14 +29,17 @@ public class Config {
@Getter(AccessLevel.NONE) @Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE) @Setter(AccessLevel.NONE)
private static Config config = null; private static Config config = null;
@Getter(AccessLevel.NONE)
CommandLineParser parser = new DefaultParser();
@Getter(AccessLevel.NONE)
HelpFormatter formatter = new HelpFormatter();
private File configPath; private File configPath;
@CommandLine.Option(names = {"-a", "--attribute-config"}, required = true, arity = "1..*", converter = AttributeConfigConverter.class)
private List<AttributeConfig> attributeConfig;
@CommandLine.Option(names = {"-l", "--library"}, required = true, description = "path to library") @CommandLine.Option(names = {"-l", "--library"}, required = true, description = "path to library")
private File libraryPath; private File libraryPath;
@CommandLine.Option(names = {"-s", "--safemode"}, description = "test run (no files will be changes)")
private boolean safeMode;
@Getter(AccessLevel.NONE) @Getter(AccessLevel.NONE)
@CommandLine.Option(names = {"-m", "--mkvtoolnix"}, defaultValue = "C:\\Program Files\\MKVToolNix", description = "path to mkvtoolnix installation") @CommandLine.Option(names = {"-m", "--mkvtoolnix"}, defaultValue = "C:\\Program Files\\MKVToolNix", description = "path to mkvtoolnix installation")
private File mkvToolNix; private File mkvToolNix;
@@ -44,38 +47,32 @@ public class Config {
@Min(value = 1) @Min(value = 1)
@CommandLine.Option(names = {"-t", "--threads"}, defaultValue = "2", description = "thread count (default: ${DEFAULT-VALUE})") @CommandLine.Option(names = {"-t", "--threads"}, defaultValue = "2", description = "thread count (default: ${DEFAULT-VALUE})")
private int threads; private int threads;
@CommandLine.Option(names = {"-i", "--include-pattern"}, defaultValue = ".*", description = "include files matching pattern (default: \".*\")")
private Pattern includePattern;
@CommandLine.Option(names = {"-s", "--safemode"}, description = "test run (no files will be changes)")
private boolean safeMode;
@CommandLine.Option(names = {"-c", "--coherent"}, description = "try to match all files in dir of depth with the same attribute config") @CommandLine.Option(names = {"-c", "--coherent"}, description = "try to match all files in dir of depth with the same attribute config")
private Integer coherent; private Integer coherent;
@CommandLine.Option(names = {"-cf", "--force-coherent"}, description = "changes are only applied if it's a coherent match") @CommandLine.Option(names = {"-cf", "--force-coherent"}, description = "changes are only applied if it's a coherent match")
private boolean forceCoherent; private boolean forceCoherent;
@CommandLine.Option(names = {"-n"}, description = "sets filter-date to last successful execution (overwrites input of filter-date)") @CommandLine.Option(names = {"-n"}, description = "sets filter-date to last successful execution (overwrites input of filter-date)")
private boolean onlyNewFiles; private boolean onlyNewFiles;
@CommandLine.Option(names = {"-d", "--filter-date"}, defaultValue = CommandLine.Option.NULL_VALUE, description = "only consider files created newer than entered date (format: \"dd.MM.yyyy-HH:mm:ss\")") @CommandLine.Option(names = {"-d", "--filter-date"}, defaultValue = CommandLine.Option.NULL_VALUE, description = "only consider files created newer than entered date (format: \"dd.MM.yyyy-HH:mm:ss\")")
private Date filterDate; private Date filterDate;
@CommandLine.Option(names = {"-i", "--include-pattern"}, defaultValue = ".*", description = "include files matching pattern (default: \".*\")")
@CommandLine.Option(names = {"-fk", "--force-keywords"}, arity = "1..*", private Pattern includePattern;
description = "Additional keywords to identify forced tracks (Defaults are will be overwritten; Default: ${DEFAULT-VALUE}")
private Set<String> forcedKeywords = new HashSet<>(Arrays.asList("forced", "signs", "songs"));
@CommandLine.Option(names = {"-ck", "--commentary-keywords"}, arity = "1..*",
description = "Additional keywords to identify commentary tracks (Defaults are will be overwritten; Default: ${DEFAULT-VALUE}")
private Set<String> commentaryKeywords = new HashSet<>(Arrays.asList("commentary", "director"));
@CommandLine.Option(names = {"-e", "--excluded-directory"}, arity = "1..*", @CommandLine.Option(names = {"-e", "--excluded-directory"}, arity = "1..*",
description = "Directories to be excluded, combines with config file") description = "Directories to be excluded, combines with config file")
private Set<String> excludedDirectories = new HashSet<>(); private Set<String> excludedDirectories = new HashSet<>();
@CommandLine.Option(names = {"-fk", "--force-keywords"}, arity = "1..*",
description = "Additional keywords to identify forced tracks (Defaults are will be overwritten; Default: ${DEFAULT-VALUE}")
private Set<String> forcedKeywords = new HashSet<>(Arrays.asList("forced", "signs", "songs"));
@CommandLine.Option(names = {"-ck", "--commentary-keywords"}, arity = "1..*",
description = "Additional keywords to identify commentary tracks (Defaults are will be overwritten; Default: ${DEFAULT-VALUE}")
private Set<String> commentaryKeywords = new HashSet<>(Arrays.asList("commentary", "director"));
@CommandLine.Option(names = {"-ps", "--preferred-subtiltes"}, arity = "1..*", @CommandLine.Option(names = {"-ps", "--preferred-subtiltes"}, arity = "1..*",
description = "Additional keywords to prefer specific subtitle tracks (Defaults are will be overwritten; Default: ${DEFAULT-VALUE}") description = "Additional keywords to prefer specific subtitle tracks (Defaults are will be overwritten; Default: ${DEFAULT-VALUE}")
private Set<String> preferredSubtitles = new HashSet<>(Arrays.asList("unstyled")); private Set<String> preferredSubtitles = new HashSet<>(Arrays.asList("unstyled"));
@CommandLine.Option(names = {"-a"}, required = true, arity = "1..*", converter = AttributeConfigConverter.class)
private List<AttributeConfig> attributeConfig;
public static Config getInstance() { public static Config getInstance() {
return getInstance(false); return getInstance(false);
@@ -109,8 +106,6 @@ public class Config {
@Override @Override
public String toString() { public String toString() {
return new StringJoiner(", ", Config.class.getSimpleName() + "[", "]") return new StringJoiner(", ", Config.class.getSimpleName() + "[", "]")
.add("parser=" + parser)
.add("formatter=" + formatter)
.add("configPath=" + configPath) .add("configPath=" + configPath)
.add("libraryPath=" + libraryPath) .add("libraryPath=" + libraryPath)
.add("mkvToolNix=" + mkvToolNix) .add("mkvToolNix=" + mkvToolNix)