Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Factory:Rebuild
plexus-cli
0001-Do-not-use-commons-cli-deprecated-classes....
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Do-not-use-commons-cli-deprecated-classes.patch of Package plexus-cli
From c35c0ecf6be620469b50cc904efc2152ba3d7dbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch> Date: Thu, 19 May 2022 09:30:24 +0200 Subject: [PATCH 1/2] Do not use commons-cli deprecated classes --- .../plexus/tools/cli/AbstractCli.java | 60 ++++++++++--------- .../codehaus/plexus/tools/cli/TestCli.java | 9 +-- 2 files changed, 38 insertions(+), 31 deletions(-) diff --git a/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java b/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java index 505c128..7e72f08 100644 --- a/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java +++ b/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java @@ -24,9 +24,9 @@ import java.util.Properties; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; -import org.apache.commons.cli.GnuParser; +import org.apache.commons.cli.DefaultParser; import org.apache.commons.cli.HelpFormatter; -import org.apache.commons.cli.OptionBuilder; +import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; import org.codehaus.plexus.ContainerConfiguration; @@ -45,17 +45,17 @@ public abstract class AbstractCli implements Cli { // These are standard options that we would want to use for all our projects. // ---------------------------------------------------------------------------- - public static final char QUIET = 'q'; + public static final String QUIET = "q"; - public static final char DEBUG = 'X'; + public static final String DEBUG = "X"; - public static final char ERRORS = 'e'; + public static final String ERRORS = "e"; - public static final char HELP = 'h'; + public static final String HELP = "h"; - public static final char VERSION = 'v'; + public static final String VERSION = "v"; - public static final char SET_SYSTEM_PROPERTY = 'D'; + public static final String SET_SYSTEM_PROPERTY = "D"; // ---------------------------------------------------------------------------- // Abstract methods @@ -284,25 +284,31 @@ public abstract class AbstractCli implements Cli { public Options buildDefaultCliOptions() { options = new Options(); - options.addOption(OptionBuilder.withLongOpt("define") + options.addOption(Option.builder( SET_SYSTEM_PROPERTY ) + .longOpt( "define" ) .hasArg() - .withDescription("Define a system property") - .create(SET_SYSTEM_PROPERTY)); - options.addOption(OptionBuilder.withLongOpt("help") - .withDescription("Display help information") - .create(HELP)); - options.addOption(OptionBuilder.withLongOpt("version") - .withDescription("Display version information") - .create(VERSION)); - options.addOption(OptionBuilder.withLongOpt("quiet") - .withDescription("Quiet output - only show errors") - .create(QUIET)); - options.addOption(OptionBuilder.withLongOpt("debug") - .withDescription("Produce execution debug output") - .create(DEBUG)); - options.addOption(OptionBuilder.withLongOpt("errors") - .withDescription("Produce execution error messages") - .create(ERRORS)); + .desc( "Define a system property" ) + .build() ); + options.addOption(Option.builder( HELP ) + .longOpt( "help" ) + .desc( "Display help information" ) + .build() ); + options.addOption(Option.builder( VERSION ) + .longOpt( "version" ) + .desc( "Display version information" ) + .build() ); + options.addOption(Option.builder( QUIET ) + .longOpt( "quiet" ) + .desc( "Quiet output - only show errors" ) + .build() ); + options.addOption(Option.builder( DEBUG ) + .longOpt( "debug" ) + .desc( "Produce execution debug output" ) + .build() ); + options.addOption(Option.builder( ERRORS ) + .longOpt( "errors" ) + .desc( "Produce execution error messages" ) + .build() ); return buildCliOptions(options); } @@ -311,7 +317,7 @@ public abstract class AbstractCli implements Cli { // We need to eat any quotes surrounding arguments... String[] cleanArgs = cleanArgs(args); - CommandLineParser parser = new GnuParser(); + CommandLineParser parser = new DefaultParser(); return parser.parse(buildDefaultCliOptions(), cleanArgs); } diff --git a/src/test/java/org/codehaus/plexus/tools/cli/TestCli.java b/src/test/java/org/codehaus/plexus/tools/cli/TestCli.java index 90f487c..9e2b318 100644 --- a/src/test/java/org/codehaus/plexus/tools/cli/TestCli.java +++ b/src/test/java/org/codehaus/plexus/tools/cli/TestCli.java @@ -19,7 +19,7 @@ package org.codehaus.plexus.tools.cli; import java.io.File; import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.OptionBuilder; +import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.util.FileUtils; @@ -33,10 +33,11 @@ public class TestCli extends AbstractCli { } public Options buildCliOptions(Options options) { - options.addOption(OptionBuilder.withLongOpt("name") - .withDescription("Display name.") + options.addOption(Option.builder( "n" ) + .longOpt( "name" ) + .desc( "Display name." ) .hasArg() - .create('n')); + .build() ); return options; } -- 2.45.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor