Added static convenience method for command-line escaping arguments (e.g. filebot/amc --def exec option)
e.g. quote(f) => "/path/to/file"
This commit is contained in:
parent
372bbcd5be
commit
c402511f56
|
@ -54,6 +54,12 @@ public class ExpressionFormatFunctions {
|
|||
return Stream.concat(Stream.of(c1, c2), Stream.of(cN)).map(ExpressionFormatFunctions::call).filter(Objects::nonNull);
|
||||
}
|
||||
|
||||
public static String quote(Object c1, Object... cN) {
|
||||
String q = String.valueOf('"');
|
||||
String r = "\\" + q;
|
||||
return stream(c1, null, cN).map(Objects::toString).map(s -> q + s.replace(q, r) + q).collect(joining(" "));
|
||||
}
|
||||
|
||||
public static Map<String, String> csv(String path) throws IOException {
|
||||
Pattern[] delimiter = { TAB, SEMICOLON };
|
||||
Map<String, String> map = new LinkedHashMap<String, String>();
|
||||
|
|
Loading…
Reference in New Issue