Permalink
Browse files

AS7-5561 incorrect command name in error message reported by scripts

  • Loading branch information...
1 parent 1cdbdb5 commit 1fe865c75ac62055e9e55b42e52b5030d4de23b9 @chengfang chengfang committed with bstansberry Oct 10, 2012
@@ -34,6 +34,6 @@ public static void init(){
public static void printUsage(final PrintStream out) {
init();
- out.print(usage());
+ out.print(usage("appclient"));
}
}
@@ -4,6 +4,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
public abstract class CommandLineArgumentUsage {
@@ -113,11 +114,13 @@ private static void segmentInstructions(String instructions, List<String> segmen
}
}
- protected static String usage() {
+ protected static String usage(String executableBaseName) {
+ boolean isWindows = (SecurityActions.getSystemProperty("os.name")).toLowerCase(Locale.ENGLISH).contains("windows");
+ String executableName = isWindows ? executableBaseName : executableBaseName + ".sh";
+
if (USAGE == null) {
final StringBuilder sb = new StringBuilder();
- sb.append(MESSAGES.argUsage()).append(NEW_LINE);
-
+ sb.append(NEW_LINE).append(MESSAGES.argUsage(executableName)).append(NEW_LINE);
for (int i = 0; i < arguments.size(); i++) {
sb.append(getCommand(i)).append(NEW_LINE);
@@ -74,6 +74,6 @@ public static void init(){
public static void printUsage(final PrintStream out) {
init();
- out.print(usage());
+ out.print(usage("domain"));
}
}
@@ -43,8 +43,8 @@
*/
ProcessMessages MESSAGES = Messages.getBundle(ProcessMessages.class);
- @Message(id = Message.NONE, value = "Usage: ./domain.sh [args...]%nwhere args include:")
- String argUsage();
+ @Message(id = Message.NONE, value = "Usage: %s [args...]%nwhere args include:")
+ String argUsage(String executableName);
/**
* Instructions for the {@link CommandLineConstants#BACKUP_DC} command line argument.
@@ -54,7 +54,7 @@ public static void init(){
public static void printUsage(final PrintStream out) {
init();
- out.print(usage());
+ out.print(usage("standalone"));
}
}

0 comments on commit 1fe865c

Please sign in to comment.