neilcsmith-net commented on code in PR #115:
URL: 
https://github.com/apache/netbeans-nbpackage/pull/115#discussion_r2387986627


##########
src/main/java/org/apache/netbeans/nbpackage/StringUtils.java:
##########
@@ -30,11 +30,31 @@
 public class StringUtils {
 
     private static final Pattern TOKEN_PATTERN = 
Pattern.compile("\\$\\{(.+?)\\}");
+    private static final Pattern SCRIPT_VAR_PATTERN = 
Pattern.compile("\\$\\{\\{(.+?)\\}\\}");
 
     private StringUtils() {
         // static utilities
     }
 
+  /**
+    * Unescapes the bash variables in the script template
+    *
+    * @param template script template
+    * @return script with unescaped variables
+    */
+    public static String unescapeScriptVars(String script)

Review Comment:
   Yes, there's `StringUtils::replaceTokens` where you want to leave any 
unmatched tokens as they are, and `StringUtils::replaceTokensOrFail` for where 
all tokens must be pre-defined.  It was done like this to allow shell scripts 
and other contexts where the same `${...}` is needed.
   
   Ideally, think about the naming in the script templates to make it clear 
which are replaced at build time though if you need both.  Maybe the additional 
tokens like `APP_DIR` should be lower case in this one?  Or make sure they all 
start with `APP_`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to