mirror of
https://github.com/jlengrand/jreleaser.git
synced 2026-03-10 08:31:24 +00:00
[cli] Allow setting System properties. Resolves #395
This commit is contained in:
@@ -28,16 +28,13 @@ import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
/**
|
||||
* @author Andres Almiray
|
||||
* @since 0.1.0
|
||||
*/
|
||||
@CommandLine.Command(mixinStandardHelpOptions = true,
|
||||
resourceBundle = "org.jreleaser.cli.Messages")
|
||||
abstract class AbstractCommand implements Callable<Integer> {
|
||||
abstract class AbstractCommand extends BaseCommand implements Callable<Integer> {
|
||||
protected JReleaserLogger logger;
|
||||
|
||||
@CommandLine.Option(names = {"-d", "--debug"})
|
||||
@@ -58,11 +55,6 @@ abstract class AbstractCommand implements Callable<Integer> {
|
||||
@CommandLine.Option(names = {"-od", "--output-directory"})
|
||||
Path outputdir;
|
||||
|
||||
@CommandLine.Spec
|
||||
CommandLine.Model.CommandSpec spec;
|
||||
|
||||
ResourceBundle bundle = ResourceBundle.getBundle("org.jreleaser.cli.Messages");
|
||||
|
||||
protected abstract Main parent();
|
||||
|
||||
public Integer call() {
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Copyright 2020-2021 The JReleaser authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jreleaser.cli;
|
||||
|
||||
import picocli.CommandLine;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* @author Andres Almiray
|
||||
* @since 0.8.0
|
||||
*/
|
||||
@CommandLine.Command(mixinStandardHelpOptions = true,
|
||||
resourceBundle = "org.jreleaser.cli.Messages")
|
||||
abstract class BaseCommand {
|
||||
@CommandLine.Spec
|
||||
CommandLine.Model.CommandSpec spec;
|
||||
|
||||
ResourceBundle bundle = ResourceBundle.getBundle("org.jreleaser.cli.Messages");
|
||||
|
||||
@CommandLine.Option(names = "-D",
|
||||
paramLabel = "<key=value>",
|
||||
descriptionKey = "system-property",
|
||||
mapFallbackValue = "")
|
||||
void setProperty(Map<String, String> props) {
|
||||
props.forEach((k, v) -> System.setProperty(k, v));
|
||||
}
|
||||
}
|
||||
@@ -26,21 +26,16 @@ import java.io.PrintWriter;
|
||||
* @since 0.1.0
|
||||
*/
|
||||
@CommandLine.Command(name = "jreleaser",
|
||||
resourceBundle = "org.jreleaser.cli.Messages",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = Versions.class,
|
||||
subcommands = {Init.class, Config.class, Template.class,
|
||||
Assemble.class, Changelog.class,
|
||||
Checksum.class, Sign.class, Upload.class,
|
||||
Release.class, Prepare.class, Package.class,
|
||||
Publish.class, Announce.class, FullRelease.class})
|
||||
public class Main implements Runnable {
|
||||
public class Main extends BaseCommand implements Runnable {
|
||||
PrintWriter out;
|
||||
PrintWriter err;
|
||||
|
||||
@CommandLine.Spec
|
||||
CommandLine.Model.CommandSpec spec;
|
||||
|
||||
public void run() {
|
||||
Banner.display(out);
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ usage.synopsisHeading = %nUsage:\u0020
|
||||
usage.optionListHeading = %nOptions:%n
|
||||
usage.commandListHeading = %nCommands:%n
|
||||
usage.footerHeading = %nDocumentation found at https://jreleaser.org%n
|
||||
helpCommand.command = COMMAND
|
||||
help = Show this help message and exit.
|
||||
version = Print version information and exit.
|
||||
# options
|
||||
@@ -52,6 +53,7 @@ ERROR_unexpected_error = Unexpected error
|
||||
# options
|
||||
config-file = The config file.
|
||||
git-root-search = Searches for the Git root.
|
||||
system-property = Sets a System property
|
||||
set-property = Sets the value of a property. Repeatable.
|
||||
# text
|
||||
TEXT_config_file = Configuring with {}
|
||||
|
||||
Reference in New Issue
Block a user