Skip to content

Commit 981297b

Browse files
authored
Reducing duplicate code within the archive helper tool (#1368)
* Moved help option declaration to CommonOptions to reduce duplicate code * restored sorted options for subcommands
1 parent 4ef43c2 commit 981297b

File tree

85 files changed

+91
-734
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+91
-734
lines changed

core/src/main/java/oracle/weblogic/deploy/tool/ArchiveHelper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
ListCommand.class,
3636
RemoveCommand.class
3737
},
38-
sortOptions = false,
3938
versionProvider = ArchiveHelperVersionProvider.class
4039
)
4140
public class ArchiveHelper {

core/src/main/java/oracle/weblogic/deploy/tool/archive_helper/CommonOptions.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@
1313
import oracle.weblogic.deploy.util.FileUtils;
1414
import oracle.weblogic.deploy.util.StringUtils;
1515
import oracle.weblogic.deploy.util.WLSDeployArchive;
16-
1716
import picocli.CommandLine.Option;
18-
import picocli.CommandLine.Spec;
1917
import picocli.CommandLine.Unmatched;
20-
import picocli.CommandLine.Model.CommandSpec;
2118

2219
import static oracle.weblogic.deploy.tool.ArchiveHelper.LOGGER_NAME;
2320

@@ -28,8 +25,14 @@ public abstract class CommonOptions {
2825
@Unmatched
2926
protected List<String> unmatchedOptions;
3027

31-
@Spec
32-
protected CommandSpec spec;
28+
@Option(
29+
names = { "-help" },
30+
description = "Get help for the ${COMMAND-FULL-NAME} command",
31+
usageHelp = true,
32+
defaultValue = "false"
33+
)
34+
@SuppressWarnings("unused")
35+
private boolean helpRequested;
3336

3437
@Option(
3538
names = { "-archive_file" },

core/src/main/java/oracle/weblogic/deploy/tool/archive_helper/add/AddApplicationCommand.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
header = "Add application to the archive file.",
2525
description = "%nCommand-line options:",
2626
footer = "%nNote: If using an Application Installation Directory, " +
27-
"please see the archiveHelper add structuredApplication command.%n",
28-
sortOptions = false
27+
"please see the archiveHelper add structuredApplication command.%n"
2928
)
3029
public class AddApplicationCommand extends AddTypeCommandBase {
3130
private static final String CLASS = AddApplicationCommand.class.getName();
@@ -40,13 +39,6 @@ public class AddApplicationCommand extends AddTypeCommandBase {
4039
)
4140
private String sourcePath;
4241

43-
@Option(
44-
names = { "-help" },
45-
description = "Get help for the archiveHelper add application subcommand",
46-
usageHelp = true
47-
)
48-
private boolean helpRequested = false;
49-
5042
@Override
5143
public CommandResponse call() throws Exception {
5244
final String METHOD = "call";

core/src/main/java/oracle/weblogic/deploy/tool/archive_helper/add/AddApplicationPlanCommand.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
@Command(
2121
name = "applicationPlan",
2222
header = "Add application deployment plan to the archive file.",
23-
description = "%nCommand-line options:",
24-
sortOptions = false
23+
description = "%nCommand-line options:"
2524
)
2625
public class AddApplicationPlanCommand extends AddTypeCommandBase {
2726
private static final String CLASS = AddApplicationPlanCommand.class.getName();
@@ -36,13 +35,6 @@ public class AddApplicationPlanCommand extends AddTypeCommandBase {
3635
)
3736
private String sourcePath;
3837

39-
@Option(
40-
names = { "-help" },
41-
description = "Get help for the archiveHelper add applicationPlan subcommand",
42-
usageHelp = true
43-
)
44-
private boolean helpRequested = false;
45-
4638
@Override
4739
public CommandResponse call() throws Exception {
4840
final String METHOD = "call";

core/src/main/java/oracle/weblogic/deploy/tool/archive_helper/add/AddClasspathLibraryCommand.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
@Command(
2121
name = "classpathLibrary",
2222
header = "Add classpath library to the archive file.",
23-
description = "%nCommand-line options:",
24-
sortOptions = false
23+
description = "%nCommand-line options:"
2524
)
2625
public class AddClasspathLibraryCommand extends AddTypeCommandBase {
2726
private static final String CLASS = AddClasspathLibraryCommand.class.getName();
@@ -36,13 +35,6 @@ public class AddClasspathLibraryCommand extends AddTypeCommandBase {
3635
)
3736
private String sourcePath;
3837

39-
@Option(
40-
names = { "-help" },
41-
description = "Get help for the archiveHelper add classpathLibrary subcommand",
42-
usageHelp = true
43-
)
44-
private boolean helpRequested = false;
45-
4638
@Override
4739
public CommandResponse call() throws Exception {
4840
final String METHOD = "call";

core/src/main/java/oracle/weblogic/deploy/tool/archive_helper/add/AddCoherenceConfigCommand.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
@Command(
2121
name = "coherenceConfig",
2222
header = "Add a Coherence config file to the archive file.",
23-
description = "%nCommand-line options:",
24-
sortOptions = false
23+
description = "%nCommand-line options:"
2524
)
2625
public class AddCoherenceConfigCommand extends AddTypeCommandBase {
2726
private static final String CLASS = AddCoherenceConfigCommand.class.getName();
@@ -43,13 +42,6 @@ public class AddCoherenceConfigCommand extends AddTypeCommandBase {
4342
)
4443
protected String clusterName;
4544

46-
@Option(
47-
names = { "-help" },
48-
description = "Get help for the archiveHelper add coherenceConfig subcommand",
49-
usageHelp = true
50-
)
51-
private boolean helpRequested = false;
52-
5345
@Override
5446
public CommandResponse call() throws Exception {
5547
final String METHOD = "call";

core/src/main/java/oracle/weblogic/deploy/tool/archive_helper/add/AddCoherencePersistenceDirCommand.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
@Command(
1919
name = "coherencePersistenceDir",
2020
header = "Add a Coherence persistence directory to the archive file.",
21-
description = "%nCommand-line options:",
22-
sortOptions = false
21+
description = "%nCommand-line options:"
2322
)
2423
public class AddCoherencePersistenceDirCommand extends AddTypeCommandBase {
2524
private static final String CLASS = AddCoherencePersistenceDirCommand.class.getName();
@@ -41,13 +40,6 @@ public class AddCoherencePersistenceDirCommand extends AddTypeCommandBase {
4140
)
4241
private String directoryType;
4342

44-
@Option(
45-
names = { "-help" },
46-
description = "Get help for the archiveHelper add coherencePersistenceDir subcommand",
47-
usageHelp = true
48-
)
49-
private boolean helpRequested = false;
50-
5143
@Override
5244
public CommandResponse call() throws Exception {
5345
final String METHOD = "call";

core/src/main/java/oracle/weblogic/deploy/tool/archive_helper/add/AddCommand.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
AddSharedLibraryCommand.class,
3434
AddSharedLibraryPlanCommand.class,
3535
AddStructuredApplicationCommand.class,
36-
},
37-
sortOptions = false
36+
}
3837
)
3938
public class AddCommand {
4039
@Option(

core/src/main/java/oracle/weblogic/deploy/tool/archive_helper/add/AddCustomCommand.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
@Command(
2323
name = "custom",
2424
header = "Add custom file/directory to the archive file.",
25-
description = "%nCommand-line options:",
26-
sortOptions = false
25+
description = "%nCommand-line options:"
2726
)
2827
public class AddCustomCommand extends AddTypeCommandBase {
2928
private static final String CLASS = AddCustomCommand.class.getName();
@@ -45,13 +44,6 @@ public class AddCustomCommand extends AddTypeCommandBase {
4544
)
4645
private String archivePath = null;
4746

48-
@Option(
49-
names = { "-help" },
50-
description = "Get help for the archiveHelper add custom subcommand",
51-
usageHelp = true
52-
)
53-
private boolean helpRequested = false;
54-
5547
@Override
5648
public CommandResponse call() throws Exception {
5749
final String METHOD = "call";

core/src/main/java/oracle/weblogic/deploy/tool/archive_helper/add/AddDatabaseWalletCommand.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
@Command(
2121
name = "databaseWallet",
2222
header = "Add database wallet to the archive file.",
23-
description = "%nCommand-line options:",
24-
sortOptions = false
23+
description = "%nCommand-line options:"
2524
)
2625
public class AddDatabaseWalletCommand extends AddTypeCommandBase {
2726
private static final String CLASS = AddDatabaseWalletCommand.class.getName();
@@ -44,13 +43,6 @@ public class AddDatabaseWalletCommand extends AddTypeCommandBase {
4443
)
4544
private String sourcePath;
4645

47-
@Option(
48-
names = { "-help" },
49-
description = "Get help for the archiveHelper add databaseWallet subcommand",
50-
usageHelp = true
51-
)
52-
private boolean helpRequested = false;
53-
5446
@Override
5547
public CommandResponse call() throws Exception {
5648
final String METHOD = "call";

0 commit comments

Comments
 (0)