public class NshOptions extends Object implements Cloneable
NshOptions holds the POSIX and Bash compatible command-line flags and
runtime execution options for an NSH shell session. These options determine
how the shell runs (e.g. interactive vs batch, bash dialect vs posix,
debugging flags like xtrace or verbose, startup script files, etc.).
Unlike NshConfig, which handles engine construction
and dependency injection (evaluator, executors, builtins, error handler),
NshOptions represents the runtime session state. It is
initialized from parsed command-line arguments (or configured programmatically via
NshConfig.setOptions(NshOptions)), and can be dynamically
modified during execution (for example via shell builtins like set -x or
set -e).
NshConfig,
DefaultNshOptionsParser| Modifier and Type | Field and Description |
|---|---|
boolean |
bash
maximize compatibility with bash
|
boolean |
command |
List<String> |
commandArgs |
boolean |
debugger |
boolean |
dumpPoStrings |
boolean |
dumpStrings |
boolean |
effectiveInteractive |
boolean |
errExit |
boolean |
exitAfterProcessingLines |
boolean |
interactive |
boolean |
login |
boolean |
noEditing |
boolean |
noProfile |
boolean |
noRc |
boolean |
posix |
String |
rcFile |
boolean |
readCommandsFromStdIn
-s option
|
boolean |
restricted |
boolean |
verbose |
boolean |
xtrace |
| Constructor and Description |
|---|
NshOptions() |
| Modifier and Type | Method and Description |
|---|---|
NshOptions |
clone() |
NshOptions |
copy()
Creates a deep copy of this options instance.
|
List<String> |
getCommandArgs() |
List<String> |
getFiles() |
String |
getRcFile() |
String |
getScriptName()
Alias for
getServiceName(), representing the script or command name ($0). |
String |
getServiceName()
The script name or command invocation name (positional parameter $0).
|
String |
getShutdownScript() |
String |
getStartupScript() |
boolean |
isBash() |
boolean |
isCommand() |
boolean |
isDebugger() |
boolean |
isDumpPoStrings() |
boolean |
isDumpStrings() |
boolean |
isEffectiveInteractive() |
boolean |
isErrExit() |
boolean |
isExitAfterProcessingLines() |
boolean |
isHelp() |
boolean |
isInteractive() |
boolean |
isLogin() |
boolean |
isNoEditing() |
boolean |
isNoProfile() |
boolean |
isNoRc() |
boolean |
isNsh() |
boolean |
isPosix() |
boolean |
isReadCommandsFromStdIn() |
boolean |
isRestricted() |
boolean |
isVerbose() |
boolean |
isVersion() |
boolean |
isXtrace() |
NshOptions |
setBash(boolean bash) |
NshOptions |
setCommand(boolean command) |
NshOptions |
setCommandArgs(List<String> commandArgs) |
NshOptions |
setDebugger(boolean debugger) |
NshOptions |
setDumpPoStrings(boolean dumpPoStrings) |
NshOptions |
setDumpStrings(boolean dumpStrings) |
NshOptions |
setEffectiveInteractive(boolean effectiveInteractive) |
NshOptions |
setErrExit(boolean errExit) |
NshOptions |
setExitAfterProcessingLines(boolean exitAfterProcessingLines) |
NshOptions |
setFiles(List<String> files) |
NshOptions |
setHelp(boolean help) |
NshOptions |
setInteractive(boolean interactive) |
NshOptions |
setLogin(boolean login) |
NshOptions |
setNoEditing(boolean noEditing) |
NshOptions |
setNoProfile(boolean noProfile) |
NshOptions |
setNoRc(boolean noRc) |
NshOptions |
setPosix(boolean posix) |
NshOptions |
setRcFile(String rcFile) |
NshOptions |
setReadCommandsFromStdIn(boolean readCommandsFromStdIn) |
NshOptions |
setRestricted(boolean restricted) |
NshOptions |
setScriptName(String scriptName)
Alias for
setServiceName(String), representing the script or command name ($0). |
NshOptions |
setServiceName(String serviceName)
Sets the script name or command invocation name (positional parameter $0).
|
NshOptions |
setShutdownScript(String shutdownScript) |
NshOptions |
setStartupScript(String startupScript) |
NshOptions |
setVerbose(boolean verbose) |
NshOptions |
setVersion(boolean version) |
NshOptions |
setXtrace(boolean xtrace) |
public boolean verbose
public boolean xtrace
public boolean errExit
public boolean restricted
public boolean interactive
public boolean effectiveInteractive
public boolean posix
public boolean exitAfterProcessingLines
public boolean bash
public boolean noRc
public boolean noProfile
public boolean noEditing
public boolean dumpPoStrings
public boolean dumpStrings
public boolean login
public boolean debugger
public boolean readCommandsFromStdIn
public String rcFile
public boolean command
public boolean isVerbose()
public NshOptions setVerbose(boolean verbose)
public boolean isXtrace()
public NshOptions setXtrace(boolean xtrace)
public boolean isRestricted()
public NshOptions setRestricted(boolean restricted)
public boolean isInteractive()
public NshOptions setInteractive(boolean interactive)
public boolean isPosix()
public NshOptions setPosix(boolean posix)
public boolean isNoRc()
public NshOptions setNoRc(boolean noRc)
public boolean isNoProfile()
public NshOptions setNoProfile(boolean noProfile)
public boolean isNoEditing()
public NshOptions setNoEditing(boolean noEditing)
public boolean isDumpPoStrings()
public NshOptions setDumpPoStrings(boolean dumpPoStrings)
public boolean isDumpStrings()
public NshOptions setDumpStrings(boolean dumpStrings)
public boolean isLogin()
public NshOptions setLogin(boolean login)
public boolean isDebugger()
public NshOptions setDebugger(boolean debugger)
public String getRcFile()
public NshOptions setRcFile(String rcFile)
public boolean isReadCommandsFromStdIn()
public NshOptions setReadCommandsFromStdIn(boolean readCommandsFromStdIn)
public boolean isBash()
public NshOptions setBash(boolean bash)
public boolean isCommand()
public NshOptions setCommand(boolean command)
public NshOptions setCommandArgs(List<String> commandArgs)
public NshOptions setFiles(List<String> files)
public boolean isExitAfterProcessingLines()
public NshOptions setExitAfterProcessingLines(boolean exitAfterProcessingLines)
public String getServiceName()
NshConfig.getServiceName().public NshOptions setServiceName(String serviceName)
serviceName - script or invocation namepublic String getScriptName()
getServiceName(), representing the script or command name ($0).public NshOptions setScriptName(String scriptName)
setServiceName(String), representing the script or command name ($0).scriptName - script name ($0)public String getStartupScript()
public NshOptions setStartupScript(String startupScript)
public String getShutdownScript()
public NshOptions setShutdownScript(String shutdownScript)
public boolean isVersion()
public NshOptions setVersion(boolean version)
public boolean isHelp()
public NshOptions setHelp(boolean help)
public boolean isEffectiveInteractive()
public NshOptions setEffectiveInteractive(boolean effectiveInteractive)
public boolean isErrExit()
public NshOptions setErrExit(boolean errExit)
public boolean isNsh()
public NshOptions copy()
public NshOptions clone()
Copyright © 2026 vpc open source initiative. All rights reserved.