Julien Viet
julienviet.com
On Monday 9 June 2014 at 20:43, John Dewsnip wrote:
> Hi,
>
> I have a few questions about running CRaSH as a main in IntelliJ. This is the first time I have run the shell.
>
> 1. Is org.crsh.cli.impl.bootstrap.Main the right main to run from IntelliJ?
likely the most convenient way, never really thought about this use case.
>
> 2. When I run I get the following extra format chars which I am guessing is due incorrect term detection. How do I make them go away?
>
> [1mNAME [0m DESCRIPTION
> [31mdashboard [0m a monitoring dashboard
> [31megrep [0m search file(s) for lines that match a pattern
> [31menv [0m display the term env
> [31mfilter [0m a filter for a stream of map
> [31mjava [0m various java language commands
> [31mjdbc [0m JDBC connection
by having a proper detection of this use case and reconfiguring the console connector to skip the rendering the style objects which would at some point change this class:
https://github.com/crashub/crash/blob/master/shell/src/main/java/org/crsh/console/jline/JLineProcessor.java
and change:
public void write(Style d) throws IOException {
d.writeAnsiTo(writer);
}
to something like:
public void write(Style d) throws IOException {
if (ansi) {
d.writeAnsiTo(writer);
}
}
Same for “cls”.
Can you put a break point in the class
https://github.com/crashub/crash/blob/master/shell/src/main/java/org/crsh/standalone/CRaSH.java at line 366 and let us know if ansi detection happens properly in the blocks:
if (!term.isAnsiSupported()) {
out = AnsiConsole.out;
err = AnsiConsole.err;
} else {
out = new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.out), 16384), false);
err = new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.err), 16384), false);
}
if that works well, then it would be fairly easy to reconfigure the console connector to add a “ansi” option.
>
>
> 3. I've added extra java based commands and these are on the classpath with the method annotated with @Command. I can't see them in help or run them. What else do I need to do?
Two solutions:
1/ you provide the code source .java or .groovy and let CRaSH compile it for you with configuration of the source as a mount point provider. classpath:/crash/commands/ is mounted by default, so having the sources in a package crash/commands would work out of the box. See
http://www.crashub.org/beta/reference.html#_mount_point_configuration
2/ implement your own CommandResolver that can return classes and declare it as a CRaSH plugin. This test case does exactly that :
https://github.com/crashub/crash/blob/master/shell/src/test/java/org/crsh/shell/impl/command/CustomCommandResolverTestCase.java
>
>
> I hope you can help.
>
> Regs.
>
> --
> Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "CRaSH User Group".
> Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse
crash-users...@googlegroups.com (mailto:
crash-users...@googlegroups.com).
> Pour obtenir davantage d'options, consultez la page
https://groups.google.com/d/optout.