Skip to content

Commit

Permalink
fixed execution bug with parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
pkelaita committed Sep 1, 2017
1 parent ee479de commit faa2682
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changelog


## Version 1.0
### 1.0.1 - 2017-08-31
#### Fixed
- Bug involving zero-parameter usage
- Extra lines in CLI
10 changes: 8 additions & 2 deletions src/main/java/com/jModule/def/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,16 @@ public void resetUsage(String reset) {
* @return any data returned by the command logic, if any
*/
public void execute(String[] args) {
if ((args.length == 0 && logic.getParams() == null) || (args.length == logic.getParams().size())) {
int paramNum;
if (params == null) {
paramNum = 0;
} else {
paramNum = params.length;
}
if (paramNum == args.length) {
logic.runCommand(args);
} else {
System.out.println("\n" + getUsage() + "\n");
System.out.println(getUsage() + "\n");
}
}
}

0 comments on commit faa2682

Please sign in to comment.