aeshell / aesh Goto Github PK
View Code? Open in Web Editor NEWÆsh is a Java library for handling console input.
Home Page: http://aeshell.github.com
License: Apache License 2.0
Æsh is a Java library for handling console input.
Home Page: http://aeshell.github.com
License: Apache License 2.0
Dear,
I would like to know if it is possible to mixt Antlr and aesh callback. Indeed Antlr seem to be powerful to parse user input while aesh is able to use input (with completion support) and output console.
Thanks for your help
Am I missing something or do the latest versions of aesh (2.3 according to https://mvnrepository.com/artifact/org.aesh/aesh and 1.1.7 according to https://mvnrepository.com/artifact/org.aesh/aesh-readline) not actually fix the many split-package errors described in https://issues.jboss.org/browse/AESH-458?_sscc=t ?
As things stand now I can't seem to get aesh to work on JDK11. Is it supported at all?
Also, it might be a good idea to update https://github.com/aeshell/aesh/blob/master/README.asciidoc . The code described there doesn't actually work. Instead of including deprecated code it might make sense to link to https://github.com/aeshell/aesh/blob/master/examples/src/main/java/examples/SimpleExample.java. Links to code in the git repository won't go out of date.
class Main {
static main(args) {
new AeshConsoleBuilder()
.addCommand(new GoldCommand())
.executeAtStart('gold\n') // here
.create()
.start()
}
}
It should be possible to input and output special characters, like áéíóúÁÉÍÓÚÂÊÎÔÛãõñç
Add a field to @CommandDefinition that will automatically create a help option to the command.
Key operations are received as a stream of ints, the problem is when some commands start with a int that is used as a defined command. Eg escape is 27 and on posix systems all arrow keys start with 27+two other ints. Whats needed is a separate thread that parses input and must (within a specified timespan) parse which key operation thats pressed.
JReadline only support changing case on one char at a time. should support changing chars on word/line.
I have a command which inherits from an abstract class which has shared options annotated with @option. The native generator however creates a json file that works only for declared methods/fields.
We have a problem here when starting jboss-cli.sh from a recent jboss-7.3.3 here and I think it is related to aesh.
Sometimes the CLI does not start and the Error message is:
java.io.FileNotFoundException: /home/jboss/.aesh_aliases (No such file or directory): /home/jboss/.aesh_aliases (No such file or directory)
This looks much like a parallelization problem. We are using ansible to set up 4 different jboss servers simultaniously during our deployment so I gues when you start all 4 cli's at the same time like so:
/opt2/jboss1/bin/jboss_cli.sh && /opt2/jboss2/bin/jboss_cli.sh && /opt2/jboss3/bin/jboss_cli.sh && /opt2/jboss4/bin/jboss_cli.sh
it sometimes happens that the first cli somehow has deleted .aesh_aliases when another cli is trying to open it.
As I think a shell should be startable at any given time this exception should be handled that more appropriate than just not letting the shell fail.
Should be possible to override default config by stripping away every ansi command thats sent to the terminal.
While path completion works fine, o.a.io.FileResource.read()
passes the file parameter directly to FileInputStream
and that cannot process the path as reference to home directory.
JReadline should implement simple redirection support.
Fist step should be to redirect standard output to file. eg: ls > dirlist.txt
executeCommand internally can obtain the CommandResult from the executor. It would make codepaths much simpler (and help resolve https://github.com/project-ncl/bacon/issues/296 ) if instead of 'void' it returned the CommandResult
value.
It should be possible to override the default (jreadline) name of the cli.
With the implementation of pipes and redirect standard error is also needed.
this happen when we try just print one char:
graphics.drawString("1", width, 1);
graphics.drawString("12", width - 1, 2);
graphics.drawString("123", width - 2, 3);
graphics.drawString("1", width - 1, 1); // < -----
graphics.drawString("12", width - 1, 2);
graphics.drawString("123", width - 2, 3);
works for string with 2+ chars:
graphics.drawString(" 1", width - 1, 1); // < ----- added blank char
graphics.drawString("12", width - 1, 2);
graphics.drawString("123", width - 2, 3);
The parser must validate and store the appropriate data depending on the defined parameter/options
JReadline should implement simple pipeline support.
The format of a pipeline is: command [ [ | OR |&] command2 ... ]
The standard output of command is connected via a pipe to the standard output of command2..
When a shell isn't set, DefaultCommandInvocation
uses DefaultShell
. The readLine
method ignores the fact that the prompt is masked and always uses console.readLine()
I am only using the readline functionality of Aesh. My code is quite simple:
import java.io.IOException
import org.jboss.aesh.console.Console
import org.jboss.aesh.console.AeshConsoleCallback
import org.jboss.aesh.console.ConsoleOperation
import org.jboss.aesh.console.Prompt
import org.jboss.aesh.console.settings.SettingsBuilder
object Repl {
def main(args: Array[String]) {
val console = new Console(new SettingsBuilder().create())
console.setPrompt(new Prompt("$ "))
console.setConsoleCallback(new AeshConsoleCallback() {
override def execute(output: ConsoleOperation): Int = {
if (output.getBuffer == "exit") {
try {
console.stop()
} catch {
case e: IOException => e.printStackTrace()
}
} else {
new SQLParser().parse(output.getBuffer) match {
case Some(select) => console.getShell.out().println("Successfully parsed SQL: \n" + select.sql)
case None => console.getShell.out().println("SQL could not be parsed")
}
}
return 0
}
})
console.start()
}
}
I have noticed that whenever the character '<' is typed, aesh attempts to read content from the file following the character.
I don't know how to disable this, if it's even possible.
I think by default, aesh should do NO preprocessing of input in the buffer unless explicitly told to (currently I have no idea how many other cases it will try to handle).
When the user enter an incomplete command such as a quote beginning, the shell should prompt for the end of the command before actually processing the command, as done in unix shells.
Not sure what exactly I pressed when scrolling through command history, but I got this:
[hyperfoil]$ Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:422)
at java.util.ArrayList.get(ArrayList.java:435)
at org.aesh.readline.history.InMemoryHistory.get(InMemoryHistory.java:89)
at org.aesh.readline.history.InMemoryHistory.getPreviousFetch(InMemoryHistory.java:119)
at org.aesh.readline.action.mappings.PrevHistory.accept(PrevHistory.java:37)
at org.aesh.readline.Readline$AeshInputProcessor.parse(Readline.java:235)
at org.aesh.readline.Readline$AeshInputProcessor.access$100(Readline.java:174)
at org.aesh.readline.Readline.readInput(Readline.java:95)
at org.aesh.readline.Readline.access$1000(Readline.java:57)
at org.aesh.readline.Readline$AeshInputProcessor.lambda$start$1(Readline.java:324)
at org.aesh.terminal.EventDecoder.accept(EventDecoder.java:118)
at org.aesh.terminal.EventDecoder.accept(EventDecoder.java:31)
at org.aesh.io.Decoder.write(Decoder.java:133)
at org.aesh.readline.tty.terminal.TerminalConnection.openBlocking(TerminalConnection.java:216)
at org.aesh.readline.tty.terminal.TerminalConnection.openBlocking(TerminalConnection.java:203)
at org.aesh.readline.ReadlineConsole.accept(ReadlineConsole.java:235)
at org.aesh.readline.ReadlineConsole.accept(ReadlineConsole.java:87)
at org.aesh.readline.tty.terminal.TerminalConnection.init(TerminalConnection.java:153)
at org.aesh.readline.tty.terminal.TerminalConnection.<init>(TerminalConnection.java:86)
at org.aesh.readline.tty.terminal.TerminalConnection.<init>(TerminalConnection.java:96)
at org.aesh.readline.ReadlineConsole.start(ReadlineConsole.java:183)
at org.aesh.AeshConsoleRunner.start(AeshConsoleRunner.java:115)
at io.hyperfoil.cli.HyperfoilCli.main(HyperfoilCli.java:116)
JReadline need to provide api/support for external processes/commands to run in the foreground.
JReadline need to send user input to these commands.
parser should push properties into settings
Currently the redirect and pipeline implementation is simple and insufficient. It need to support all possible functions and handle syntax error and escaped spaces.
Need to add a timeout on terminal height/width so line breaking ++ still will work when user changes the terminal size.
If the first character of a value is an - that don't work.
Example: foo -myvalue
But if you use a double quote and space that work.
Example: foo " -myvalue"
It would be nice if a value beginning with - and matching any option is taken as a value of the previous option.
The native generator has a number of shortcomings:
Aesh looks like a really cool project. It even has graphics!
We're looking into commands that would print syntax-highlighted XML and JSon to the console... unless their output is being routed to a file or pipe in which case we don't want any Ansi highlight codes in the output.
How would you accomplish this with Aesh?
Is it possible to integrate Jansi (https://github.com/fusesource/jansi) with aesh? Jansi solves this problem nicely but it's not obvious how to integrate it with aesh.
Config.java prints out "not a file" on stdout if the inputrc file cannot be found (default config). It should fail silently
Reproducer: https://github.com/thescouser89/aesh-reproducer
Aesh version: 2.6
Affects: https://github.com/project-ncl/bacon/issues/328
The CLI is configured to have 1 required argument and 1 optional flag (--flag) aesh CLI does not fail on missing argument if a boolean flag is specified.
Expected successful run:
java -jar <app> test helloworld --verbose
# or
java -jar <app> test helloworld
where 'test' is the command, and 'helloworld' the argument
if I run:
java -jar <app> test --verbose
I expect the CLI to fail with missing argument error. Instead, it happily moves ahead with further processing, setting the argument field to null.
The parameter need a util method to print out usage and options data
I'm trying to use:
CommandRuntime runtime = AeshCommandRuntimeBuilder.builder().commandRegistry(registry).build();
runtime.executeCommand(line);
But can't figure out how to pass option with this value: test=="some thing"
Tried these things already:
some command --query "name==\"some thing\""
=> test==\"some thing\"
some command --query name=="some thing"
=> test==some thing
some command --query "name=="\""some thing"\"""
=>
and unknown argument "some thing
Also the problem is that I already have String[] args and I need a way to concatenate them somehow first for aesh later split them again to the same things before concatenation.
Default log file should be set to /tmp to preven pollution of working dir
JReadline currently only switch between edit modes, gnu readline have properties to specify either vi or emacs mode.
alias should work similar to posix alias. - it should also be possible to disable it from Settings
Fileutils need to handle:
The api need to provide an easy way to define parameters/options for a command
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.