415827 - jetty-start / update --help text for new command line options

+ Making help actually print out
This commit is contained in:
Joakim Erdfelt 2013-08-26 13:03:34 -07:00
parent 7c21874535
commit 71e10b7bd2
2 changed files with 26 additions and 7 deletions

View File

@ -419,7 +419,7 @@ public class Main
// Show the usage information and return
if (args.isHelp())
{
usage();
usage(true);
}
// Show the version information and return
@ -470,7 +470,7 @@ public class Main
persistence.enableModule(args,module);
}
}
if (args.isStopCommand())
{
int stopPort = Integer.parseInt(args.getProperties().getProperty("STOP.PORT"));
@ -493,8 +493,6 @@ public class Main
return;
}
// execute Jetty in another JVM
if (args.isExec())
{
@ -609,7 +607,7 @@ public class Main
}
}
private void usage()
public void usage(boolean exit)
{
String usageResource = "org/eclipse/jetty/start/usage.txt";
boolean usagePresented = false;
@ -620,17 +618,29 @@ public class Main
try (InputStreamReader reader = new InputStreamReader(usageStream); BufferedReader buf = new BufferedReader(reader))
{
usagePresented = true;
String line;
while ((line = buf.readLine()) != null)
{
System.out.println(line);
}
}
}
else
{
System.out.println("No usage.txt ??");
}
}
catch (IOException e)
{
StartLog.debug(e);
StartLog.warn(e);
}
if (!usagePresented)
{
System.err.println("ERROR: detailed usage resource unavailable");
}
System.exit(EXIT_USAGE);
if (exit)
{
System.exit(EXIT_USAGE);
}
}
}

View File

@ -24,6 +24,7 @@ import java.util.List;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
public class MainTest
@ -80,6 +81,14 @@ public class MainTest
StartArgs args = main.processCommandLine(cmdLineArgs.toArray(new String[cmdLineArgs.size()]));
main.listConfig(args);
}
@Test
@Ignore("Just a bit noisy for general testing")
public void testHelp() throws Exception
{
Main main = new Main();
main.usage(false);
}
@Test
public void testWithCommandLine() throws Exception