File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
src/mhashim6/commander/main Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,12 @@ public CommandBuilder forCommandLine(String line) {
4444 }
4545 // ============================================================
4646
47+ public CommandBuilder addOption (String option ) {
48+ if (option != null ) cmdOptions .add (option );
49+
50+ return this ;
51+ }
52+
4753 /**
4854 * side effect: will clear any previously set options if any.
4955 */
@@ -54,6 +60,12 @@ public CommandBuilder withOptions(String... params) {
5460 }
5561 // ============================================================
5662
63+ public CommandBuilder addArg (String arg ) {
64+ if (arg != null ) cmdArgs .add (arg );
65+
66+ return this ;
67+ }
68+
5769 /**
5870 * side effect: will clear any previously set arguments if any.
5971 */
@@ -84,7 +96,7 @@ private ArrayList<String> finalCmdList() {
8496 // ============================================================
8597
8698 private static String [] splitCmd (String cmd ) {
87- List <String > strings = new ArrayList <String >();
99+ List <String > strings = new ArrayList <>();
88100 Matcher m = QUOTES_PATTERN .matcher (cmd );
89101 while (m .find ())
90102 strings .add (m .group (1 ));
@@ -123,5 +135,9 @@ public String string() {
123135 return cmdLine ;
124136 }
125137
138+ @ Override
139+ public String toString () {
140+ return string ();
141+ }
126142 }
127143}
You can’t perform that action at this time.
0 commit comments