/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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
*
* http://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.apache.logging.log4j.core.tools.picocli;
import java.io.File;
import java.io.PrintStream;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.WildcardType;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.Time;
import java.text.BreakIterator;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.SortedSet;
import java.util.Stack;
import java.util.TreeSet;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.regex.Pattern;
import org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi.IStyle;
import org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi.Style;
import org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Ansi.Text;
import static java.util.Locale.ENGLISH;
import static org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Column.Overflow.SPAN;
import static org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Column.Overflow.TRUNCATE;
import static org.apache.logging.log4j.core.tools.picocli.CommandLine.Help.Column.Overflow.WRAP;
/**
* <p>
* CommandLine interpreter that uses reflection to initialize an annotated domain object with values obtained from the
* command line arguments.
* </p><h2>Example</h2>
* <pre>import static picocli.CommandLine.*;
*
* @Command(header = "Encrypt FILE(s), or standard input, to standard output or to the output file.",
* version = "v1.2.3")
* public class Encrypt {
*
* @Parameters(type = File.class, description = "Any number of input files")
* private List<File> files = new ArrayList<File>();
*
* @Option(names = { "-o", "--out" }, description = "Output file (default: print to console)")
* private File outputFile;
*
* @Option(names = { "-v", "--verbose"}, description = "Verbosely list files processed")
* private boolean verbose;
*
* @Option(names = { "-h", "--help", "-?", "-help"}, usageHelp = true, description = "Display this help and exit")
* private boolean help;
*
* @Option(names = { "-V", "--version"}, versionHelp = true, description = "Display version info and exit")
* private boolean versionHelp;
* }
* </pre>
* <p>
* Use {@code CommandLine} to initialize a domain object as follows:
* </p><pre>
* public static void main(String... args) {
* Encrypt encrypt = new Encrypt();
* try {
* List<CommandLine> parsedCommands = new CommandLine(encrypt).parse(args);
* if (!CommandLine.printHelpIfRequested(parsedCommands, System.err, Help.Ansi.AUTO)) {
* runProgram(encrypt);
* }
* } catch (ParameterException ex) { // command line arguments could not be parsed
* System.err.println(ex.getMessage());
* ex.getCommandLine().usage(System.err);
* }
* }
* </pre><p>
* Invoke the above program with some command line arguments. The below are all equivalent:
* </p>
* <pre>
* --verbose --out=outfile in1 in2
* --verbose --out outfile in1 in2
* -v --out=outfile in1 in2
* -v -o outfile in1 in2
* -v -o=outfile in1 in2
* -vo outfile in1 in2
* -vo=outfile in1 in2
* -v -ooutfile in1 in2
* -vooutfile in1 in2
* </pre>
*/
public class CommandLine {
/** This is picocli version {@value}. */
public static final String VERSION = "2.0.3";
private final Tracer tracer = new Tracer();
private final Interpreter interpreter;
private String commandName = Help.DEFAULT_COMMAND_NAME;
private boolean overwrittenOptionsAllowed = false;
private boolean unmatchedArgumentsAllowed = false;
private final List<String> unmatchedArguments = new ArrayList<>();
private CommandLine parent;
private boolean usageHelpRequested;
private boolean versionHelpRequested;
private final List<String> versionLines = new ArrayList<>();
/**
* Constructs a new {@code CommandLine} interpreter with the specified annotated object.
* When the {@link #parse(String...)} method is called, fields of the specified object that are annotated
* with {@code @Option} or {@code @Parameters} will be initialized based on command line arguments.
* @param command the object to initialize from the command line arguments
* @throws InitializationException if the specified command object does not have a {@link Command}, {@link Option} or {@link Parameters} annotation
*/
public CommandLine(final Object command) {
interpreter = new Interpreter(command);
}
/** Registers a subcommand with the specified name. For example:
* <pre>
* CommandLine commandLine = new CommandLine(new Git())
* .addSubcommand("status", new GitStatus())
* .addSubcommand("commit", new GitCommit();
* .addSubcommand("add", new GitAdd())
* .addSubcommand("branch", new GitBranch())
* .addSubcommand("checkout", new GitCheckout())
* //...
* ;
* </pre>
*
* <p>The specified object can be an annotated object or a
* {@code CommandLine} instance with its own nested subcommands. For example:</p>
* <pre>
* CommandLine commandLine = new CommandLine(new MainCommand())
* .addSubcommand("cmd1", new ChildCommand1()) // subcommand
* .addSubcommand("cmd2", new ChildCommand2())
* .addSubcommand("cmd3", new CommandLine(new ChildCommand3()) // subcommand with nested sub-subcommands
* .addSubcommand("cmd3sub1", new GrandChild3Command1())
* .addSubcommand("cmd3sub2", new GrandChild3Command2())
* .addSubcommand("cmd3sub3", new CommandLine(new GrandChild3Command3()) // deeper nesting
* .addSubcommand("cmd3sub3sub1", new GreatGrandChild3Command3_1())
* .addSubcommand("cmd3sub3sub2", new GreatGrandChild3Command3_2())
* )
* );
* </pre>
* <p>The default type converters are available on all subcommands and nested sub-subcommands, but custom type
* converters are registered only with the subc
没有合适的资源?快使用搜索试试~ 我知道了~
log4j优化文件 logging-log4j2-log4j-2.15.0-rc1.tar
需积分: 0 0 下载量 194 浏览量
2023-03-20
16:45:58
上传
评论
收藏 10.92MB GZ 举报
温馨提示
共2000个文件
java:2242个
xml:527个
gz:159个
log4j优化文件 logging-log4j2-log4j-2.15.0-rc1.tar
资源推荐
资源详情
资源评论
收起资源包目录
log4j优化文件 logging-log4j2-log4j-2.15.0-rc1.tar (2000个子文件)
CommandLine.java 283KB
Logger.java 170KB
AbstractLogger.java 115KB
JsonTemplateLayoutTest.java 77KB
CronExpression.java 61KB
StrSubstitutor.java 60KB
Generate.java 60KB
AbstractLoggerTest.java 53KB
FastDatePrinter.java 48KB
AbstractConfiguration.java 46KB
LambdaLoggerTest.java 46KB
SortedArrayStringMapTest.java 40KB
JdbcDatabaseManager.java 39KB
Log4jLogEvent.java 39KB
FlumePersistentManager.java 37KB
JsonWriterTest.java 37KB
FastDateParser.java 35KB
PatternLayoutTest.java 34KB
LogManager.java 33KB
RollingFileManager.java 33KB
XmlConfiguration.java 33KB
JdkMapAdapterStringMapTest.java 31KB
Log4jLogEventTest.java 31KB
OpenHashStringMap.java 30KB
ParameterizedMessage.java 29KB
PatternLayout.java 29KB
LoggerContext.java 29KB
JsonWriter.java 29KB
GelfLayout.java 29KB
Rfc5424Layout.java 29KB
FixedDateFormat.java 28KB
Logger.java 28KB
PatternParser.java 28KB
ParameterFormatter.java 27KB
ConfigurationFactory.java 27KB
FastDateParserTest.java 27KB
LoggerTest.java 27KB
DefaultRolloverStrategy.java 26KB
JsonLayoutTest.java 26KB
LoggerConfig.java 25KB
ThrowableProxyTest.java 25KB
PropertiesConfiguration.java 25KB
TestConfigurator.java 24KB
PropertiesUtil.java 23KB
AsyncLogger.java 23KB
DefaultConfigurationBuilder.java 23KB
Log4jBridgeHandlerTest.java 23KB
MapMessage.java 23KB
TcpSocketManager.java 23KB
JsonTemplateLayout.java 23KB
Rfc5424LayoutTest.java 23KB
ExtendedLogger.java 22KB
NoSqlDatabaseManagerTest.java 22KB
FastDateFormat.java 22KB
SortedArrayStringMap.java 21KB
Log4j1ConfigurationParser.java 21KB
FixedDateFormatTest.java 21KB
DatePatternConverterTest.java 21KB
LogstashIT.java 21KB
CompositeFilter.java 20KB
ResolverUtil.java 20KB
ThreadContext.java 19KB
Log4jWebInitializerImplTest.java 19KB
Log4jWebInitializerImplTest.java 19KB
Category.java 19KB
ResponseTimeTest.java 19KB
RoutingAppender.java 19KB
ConfigurationBuilder.java 19KB
PropertiesConfigurationBuilder.java 19KB
JmsManager.java 18KB
FileManager.java 18KB
FlumeAppenderTest.java 18KB
SocketAppender.java 18KB
AsyncLoggerConfigDisruptor.java 18KB
LoggerTest.java 18KB
MutableLogEventTest.java 18KB
ThrowableProxy.java 18KB
Server.java 18KB
Log4jContextFactory.java 18KB
Configurator.java 17KB
LoggerTest.java 17KB
AsyncAppender.java 17KB
DirectWriteRolloverStrategy.java 17KB
HtmlLayout.java 17KB
HttpAppenderTest.java 17KB
AbstractJacksonLayout.java 17KB
PatternParserTest.java 17KB
YamlLayoutTest.java 17KB
Loader.java 17KB
StructuredDataMessage.java 17KB
FlumePersistentAppenderTest.java 17KB
ExceptionResolver.java 17KB
SocketAppenderReconnectTest.java 16KB
XmlConfiguration.java 16KB
ReadOnlyStringMapResolverTest.java 16KB
SyslogAppender.java 16KB
TimestampResolver.java 16KB
SmtpManager.java 16KB
XmlLayoutTest.java 16KB
PerfTestDriver.java 16KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
卫庄大人℡
- 粉丝: 63
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 住宅梦物语加速_2.1.6.apk
- zephyr sdk package 2
- zephyr sdk package 1
- optimization.ipynb
- 数据库标识码BSM重排序工具、重构标识码工具
- 基于C语言的校园导航系统报告.doc
- __init__.py
- tensorflow-gpu-2.6.5-cp39-cp39-manylinux2010-x86-64.whl
- tensorflow-rocm-2.13.1.600-cp38-cp38-manylinux2014-x86-64.whl
- tensorflow-rocm-2.13.0.570-cp311-cp311-manylinux2014-x86-64.whl
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功