Skip to content

Commit

Permalink
Adding new style versions to special arguments (#194)
Browse files Browse the repository at this point in the history
* Adding new style versions to special arguments
     showHidden -> show-hidden
     arguments_file -> arguments-file
* The old versions are still accepted for now.
  • Loading branch information
lbergelson authored Jan 8, 2025
1 parent 1ce1171 commit 7e7f343
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,18 @@
*/
public final class SpecialArgumentsCollection {
public static final String HELP_FULLNAME = "help";
public static final String SHOW_HIDDEN_FULLNAME = "showHidden";

public static final String SHOW_HIDDEN_FULLNAME = "show-hidden";
@Deprecated
public static final String SHOW_HIDDEN_DEPRECATED = "showHidden";

public static final String VERSION_FULLNAME = "version";
public static final String ARGUMENTS_FILE_FULLNAME = "arguments_file";

public static final String ARGUMENTS_FILE_FULLNAME = "arguments-file";
@Deprecated
public static final String ARGUMENTS_FILE_DEPRECATED = "arguments_file";


private static final long serialVersionUID = 1L;

@Argument(shortName = "h", fullName = HELP_FULLNAME, doc= "display the help message", special = true)
Expand All @@ -21,10 +30,10 @@ public final class SpecialArgumentsCollection {
@Argument(fullName = VERSION_FULLNAME, doc="display the version number for this tool", special = true)
public boolean VERSION = false;

@Argument(fullName = ARGUMENTS_FILE_FULLNAME, doc="read one or more arguments files and add them to the command line", optional = true, special = true)
@Argument(fullName = ARGUMENTS_FILE_FULLNAME, shortName = ARGUMENTS_FILE_DEPRECATED, doc="read one or more arguments files and add them to the command line", optional = true, special = true)
public List<File> ARGUMENTS_FILE = new ArrayList<>();

@Advanced
@Argument(fullName = SHOW_HIDDEN_FULLNAME, shortName = SHOW_HIDDEN_FULLNAME, doc = "display hidden arguments", special = true)
@Argument(fullName = SHOW_HIDDEN_FULLNAME, shortName = SHOW_HIDDEN_DEPRECATED, doc = "display hidden arguments", special = true)
public boolean SHOW_HIDDEN = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public Object[][] argUsageCases() {
new FrobnicateArguments(), Arrays.asList(
"--FROBNICATION_FLAVOR <FrobnicationFlavor>",
"--SHMIGGLE_TYPE <String>",
"--arguments_file <File>",
"--arguments-file,-arguments_file <File>",
"--FROBNICATION_THRESHOLD,-T <Integer>",
"--TRUTHINESS <Boolean>")
},
Expand Down Expand Up @@ -352,7 +352,7 @@ public void testGetCommandLine() {
"FrobnicateArguments " +
"positional1 positional2 --FROBNICATION_THRESHOLD 17 --FROBNICATION_FLAVOR BAR " +
"--SHMIGGLE_TYPE shmiggle1 --SHMIGGLE_TYPE shmiggle2 --TRUTHINESS true --help false " +
"--version false --showHidden false");
"--version false --show-hidden false");
}

private static class WithSensitiveValues {
Expand Down

0 comments on commit 7e7f343

Please sign in to comment.