Package io.nosqlbench.engine.cli
Class NBCLIArgsFile
java.lang.Object
io.nosqlbench.engine.cli.NBCLIArgsFile
public class NBCLIArgsFile
extends java.lang.Object
Synopsis
ArgsFile is a command-line modifier which can take linked list of command args and modify it, and/or modify argsfile refrenced in this way.ArgsFile Selection
During processing, any occurence of '--argsfile' selects the active argsfile and loads it into the command line in place of the '--argsfile' argument. By default the args file will be loaded if it exists, and a warning will be given if it does not. The '--argsfile-required <somepath>' version will throw an error if the args file is not present, but it will not report any warnings or details otherwise. The `--argsfile-optional <somepath> version will not throw an error if the args file is not present, and it will not report any warnings or details otherwise. A prefix command line can be given to ArgsFile to pre-load any settings. In this way it is possible to easily provide a default args file which will be loaded. For example, A prefix command of '--argsfile-optional <somepath>' will load options if they are available in the specified file, but will otherwise provide no feedback to the user.ArgsFile Injection
When an argsfile is loaded, it reads a command from each line into the current position of the command line. No parsing is done. Blank lines are ignored. Newlines are used as the argument delimiter, and lines that end with a backslash before the newline are automatically joined together.ArgsFile Diagnostics
All modifications to the command line should be reported to the logging facility at INFO level. This assumes that the calling layer wants to inform users of command line injections, and that the user can select to be notified of warnings only if desired.Environment Variables
Simple environment variable substitution is attempted for any pattern which appears as '$' followed by all uppercase letters and underscores. Any references of this type which are not resolvable will cause an error to be thrown.-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringARGS_FILEstatic java.lang.StringARGS_FILE_OPTIONALstatic java.lang.StringARGS_FILE_REQUIREDstatic java.lang.StringARGS_PINstatic java.lang.StringARGS_UNPIN -
Constructor Summary
Constructors Constructor Description NBCLIArgsFile() -
Method Summary
Modifier and Type Method Description NBCLIArgsFilepreload(java.lang.String... preload)java.util.LinkedList<java.lang.String>process(java.lang.String... args)java.util.LinkedList<java.lang.String>process(java.util.LinkedList<java.lang.String> commandline)NBCLIArgsFilereserved(java.lang.String... reservedWords)Indicate which words are invalid for the purposes of matching trailing parts of arguments.NBCLIArgsFilereserved(java.util.Collection<java.lang.String> reservedWords)Indicate which words are invalid for the purposes of matching trailing parts of arguments.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
ARGS_FILE
public static final java.lang.String ARGS_FILE- See Also:
- Constant Field Values
-
ARGS_FILE_OPTIONAL
public static final java.lang.String ARGS_FILE_OPTIONAL- See Also:
- Constant Field Values
-
ARGS_FILE_REQUIRED
public static final java.lang.String ARGS_FILE_REQUIRED- See Also:
- Constant Field Values
-
ARGS_PIN
public static final java.lang.String ARGS_PIN- See Also:
- Constant Field Values
-
ARGS_UNPIN
public static final java.lang.String ARGS_UNPIN- See Also:
- Constant Field Values
-
-
Constructor Details
-
NBCLIArgsFile
public NBCLIArgsFile()
-
-
Method Details
-
preload
-
reserved
Indicate which words are invalid for the purposes of matching trailing parts of arguments. The provided words will not be considered as valid values to arguments in any case.- Parameters:
reservedWords- Words to ignore in option values- Returns:
- this ArgsFile, for method chaining
-
reserved
Indicate which words are invalid for the purposes of matching trailing parts of arguments. The provided words will not be considered as valid values to arguments in any case.- Parameters:
reservedWords- Words to ignore in option values- Returns:
- this ArgsFile, for method chaining
-
process
public java.util.LinkedList<java.lang.String> process(java.lang.String... args) -
process
public java.util.LinkedList<java.lang.String> process(java.util.LinkedList<java.lang.String> commandline)
-