-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
67 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...nizer-cli/src/main/java/io/jenkins/tools/pluginmodernizer/cli/command/VersionCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package io.jenkins.tools.pluginmodernizer.cli.command; | ||
|
||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; | ||
import io.jenkins.tools.pluginmodernizer.cli.VersionProvider; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import picocli.CommandLine; | ||
|
||
/** | ||
* Version command | ||
*/ | ||
@CommandLine.Command(name = "version", description = "Display version information") | ||
@SuppressFBWarnings(value = "CRLF_INJECTION_LOGS", justification = "safe because versions from pom.xml") | ||
public class VersionCommand implements ICommand { | ||
|
||
/** | ||
* Logger | ||
*/ | ||
private static final Logger LOG = LoggerFactory.getLogger(VersionCommand.class); | ||
|
||
/** | ||
* Display the short version | ||
*/ | ||
@CommandLine.Option( | ||
names = {"--short"}, | ||
description = "Display the short version") | ||
private boolean shortVersion; | ||
|
||
@Override | ||
public Integer call() throws Exception { | ||
VersionProvider versionProvider = new VersionProvider(); | ||
if (shortVersion) { | ||
LOG.info(versionProvider.getMavenVersion()); | ||
} else { | ||
LOG.info(versionProvider.getVersion()[0].trim()); | ||
} | ||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters