Skip to content
This repository has been archived by the owner on Mar 18, 2019. It is now read-only.

Commit

Permalink
Printing program name and version with usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ata4 committed Jan 18, 2016
1 parent dd5480d commit 4d35afa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
package info.ata4.disunity.cli.command;

import com.beust.jcommander.JCommander;
import info.ata4.disunity.DisUnity;
import info.ata4.junity.progress.Progress;
import java.io.PrintWriter;
import java.util.Objects;
Expand Down Expand Up @@ -38,7 +39,7 @@ public void init(JCommander commander, PrintWriter out) {
public JCommander commander() {
return commander;
}

@Override
public void run() {
String commandName = commander.getParsedCommand();
Expand All @@ -49,7 +50,7 @@ public void run() {
commandObj.run();
} else {
// no command selected, show usage
commander.usage();
usage();
}
}
}
Expand All @@ -61,6 +62,11 @@ protected JCommander addSubCommand(String commandName, Command commandObj) {
return subCommander;
}

protected void usage() {
output().println(DisUnity.getSignature());
commander().usage();
}

protected PrintWriter output() {
return out;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
*/
package info.ata4.disunity.cli.command;

import info.ata4.disunity.cli.command.bundle.BundleRoot;
import com.beust.jcommander.JCommander;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import info.ata4.disunity.cli.command.asset.AssetRoot;
import info.ata4.disunity.cli.command.bundle.BundleRoot;
import info.ata4.log.LogUtils;
import java.io.PrintWriter;
import java.util.logging.Level;
Expand Down Expand Up @@ -55,7 +55,7 @@ public void run() {

// display usage
if (help) {
commander().usage();
usage();
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static String getProgramName() {
}

public static String getVersion() {
return "0.5";
return "0.5.0";
}

public static String getSignature() {
Expand Down

0 comments on commit 4d35afa

Please sign in to comment.