Skip to content

Commit

Permalink
Improved parameter expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed Jan 24, 2020
1 parent 4e93fdb commit fe80245
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,15 @@ private void internalExecute() throws Exception {
line = line.replaceAll("\\s\\$" + i + "\\b",
args[i].startsWith("$") ? (" " + expandName(args[i]) + " ")
: (" " + quote(args[i]) + " "));
line = line.replaceAll("\\$\\{" + i + "\\}",
line = line.replaceAll("\\$\\{" + i + "(|:-.*)\\}",
args[i].startsWith("$") ? expandName(args[i]) : quote(args[i]));
}
line = line.replaceAll("\\s\\$\\d\\b", "");
line = line.replaceAll("\\$\\{\\d+\\}", "");
Matcher matcher=Pattern.compile("\\$\\{\\d+:-(.*?)\\}").matcher(line);
if (matcher.find()) {
line = matcher.replaceAll("'$1'");
}
if (verbose) {
AttributedStringBuilder asb = new AttributedStringBuilder();
asb.append(line, AttributedStyle.DEFAULT.foreground(AttributedStyle.GREEN));
Expand Down

0 comments on commit fe80245

Please sign in to comment.