[wildfly-dev] CLI Non-Interactive Output Changes

Edward Wertz ewertz at redhat.com
Fri Sep 4 10:04:31 EDT 2015


Hello All,

I've been doing some work on the non-interactive mode of the CLI, when using --file or --commands, and since the current version of the work changes the output slightly I'd like to get some opinions on it. The changes are necessary in order to pass the non-interactive commands through the AESH console system, which enables additional functionality like the history file and 'alias' command. If not done, the non-interactive mode functionality won't behave the same as the interactive mode. Commands handled by AESH like 'alias' will be missing entirely, and non-interactive commands won't show up in the cli history file. If AESH is expanded further in the future, more commands will be inaccessible in non-interactive mode.

The existing output for this mode only includes the command output. It doesn't include the commands entered, or the interactive command prompts like '[disconnected /]'. Exampled like so:

[joe at localhost bin]$ ./jboss-cli.sh --commands=version,connect,version,"echo tim"
JBoss Admin Command-line Interface
JBOSS_HOME: /home/joe/ideaProjects/wildfly-core/build/target/wildfly-core-2.0.0.CR1-SNAPSHOT
JBoss AS release: <connect to the controller and re-run the version command to see the release info>
JAVA_HOME: null
java.version: 1.8.0_45
java.vm.vendor: Oracle Corporation
java.vm.version: 25.45-b02
os.name: Linux
os.version: 4.1.6-200.fc22.x86_64
JBoss Admin Command-line Interface
JBOSS_HOME: /home/joe/ideaProjects/wildfly-core/build/target/wildfly-core-2.0.0.CR1-SNAPSHOT
JBoss AS release: 2.0.0.CR1-SNAPSHOT "Kenny"
JAVA_HOME: null
java.version: 1.8.0_45
java.vm.vendor: Oracle Corporation
java.vm.version: 25.45-b02
os.name: Linux
os.version: 4.1.6-200.fc22.x86_64
tim

The new output, as it exists right now, contains the command and it's output. Like so:

[joe at localhost Changed Output]$ ./wildfly-cli-2.0.0.CR1-SNAPSHOT-client-new.jar --commands=version,connect,version,"echo tim"
WARN: can't find jboss-cli.xml. Using default configuration values.
version
JBoss Admin Command-line Interface
JBOSS_HOME: null
JBoss AS release: <connect to the controller and re-run the version command to see the release info>
JAVA_HOME: null
java.version: 1.8.0_45
java.vm.vendor: Oracle Corporation
java.vm.version: 25.45-b02
os.name: Linux
os.version: 4.1.6-200.fc22.x86_64
connect
Warning! The CLI is running in a non-modular environment and cannot load commands from management extensions.
version
JBoss Admin Command-line Interface
JBOSS_HOME: null
JBoss AS release: 2.0.0.CR1-SNAPSHOT "Kenny"
JAVA_HOME: null
java.version: 1.8.0_45
java.vm.vendor: Oracle Corporation
java.vm.version: 25.45-b02
os.name: Linux
os.version: 4.1.6-200.fc22.x86_64
echo tim
tim

'version', 'connect', 'version', and 'echo tim' lines are now in the output, along with some information messages. I think this makes the output more useful, since the user can see which command was entered before the output or possible error occurs. It shouldn't have an impact on existing scripts, because the output still contains the expected output from any command and still ends with the last command output, so if someone is doing string analysis I wouldn't expect it to fail.

I'd actually prefer to extend this change and add the command prompts into the output as well. Which would look like this:

[joe at localhost bin]$ ./jboss-cli.sh --commands=version,"alias v=version",connect,v,"echo tim"
[disconnected /] version
JBoss Admin Command-line Interface
JBOSS_HOME: /home/joe/ideaProjects/wildfly-core/build/target/wildfly-core-2.0.0.CR1-SNAPSHOT
JBoss AS release: <connect to the controller and re-run the version command to see the release info>
JAVA_HOME: null
java.version: 1.8.0_45
java.vm.vendor: Oracle Corporation
java.vm.version: 25.45-b02
os.name: Linux
os.version: 4.1.6-200.fc22.x86_64
[disconnected /] alias v=version
[disconnected /] connect
[standalone at localhost:9990 /] v
JBoss Admin Command-line Interface
JBOSS_HOME: /home/joe/ideaProjects/wildfly-core/build/target/wildfly-core-2.0.0.CR1-SNAPSHOT
JBoss AS release: 2.0.0.CR1-SNAPSHOT "Kenny"
JAVA_HOME: null
java.version: 1.8.0_45
java.vm.vendor: Oracle Corporation
java.vm.version: 25.45-b02
os.name: Linux
os.version: 4.1.6-200.fc22.x86_64
[standalone at localhost:9990 /] echo tim
tim
[standalone at localhost:9990 /] 

This, to me, adds more information to the output making it more useful. I like the idea of the non-interactive mode imitating the interactive mode closely and essentially pretending to be a user, and this output is almost identical to a user entering these commands one at a time. It does, however, modify the end of the output stream which could break analysis scripts. A contains would be fine, but an ends-with would be broken because of the last prompt.

Normal interactive mode output is unchanged. This will only effect '--file=' and '--commands=' output.

Thoughts?

Joe Wertz


More information about the wildfly-dev mailing list