question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Colors support for CLI output

See original GitHub issue

Hi,

we are using the Jdeploy library for deploying and running the CLI tool written on Java.

Jdeploy is a great tool and everything is fine except for one little issue with colors.

If I run it as a regular Java application, colors are displayed correctly:

Screenshot from 2020-12-11 17-43-48

But if I run it as a command after installation via Jdeploy, colors are disappeared:

Screenshot from 2020-12-11 17-42-38


Tried to edit the jdeploy.js file and add --colors or --ansi to the command (cmd variable), but it doesn’t work:

Exception in thread "main" java.lang.RuntimeException: org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: --colors
	at ca.weblite.jdeploy.JDeploy.main(JDeploy.java:1174)
Caused by: org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: --colors
	at org.apache.commons.cli.DefaultParser.handleUnknownToken(DefaultParser.java:347)
	at org.apache.commons.cli.DefaultParser.handleLongOptionWithoutEqual(DefaultParser.java:394)
	at org.apache.commons.cli.DefaultParser.handleLongOption(DefaultParser.java:371)
	at org.apache.commons.cli.DefaultParser.handleToken(DefaultParser.java:239)
	at org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:120)
	at org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:76)
	at org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:60)
	at ca.weblite.jdeploy.JDeploy.main(JDeploy.java:1145)
Exception in thread "main" java.lang.RuntimeException: org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: --ansi
	at ca.weblite.jdeploy.JDeploy.main(JDeploy.java:1174)
Caused by: org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: --ansi
	at org.apache.commons.cli.DefaultParser.handleUnknownToken(DefaultParser.java:347)
	at org.apache.commons.cli.DefaultParser.handleLongOptionWithoutEqual(DefaultParser.java:394)
	at org.apache.commons.cli.DefaultParser.handleLongOption(DefaultParser.java:371)
	at org.apache.commons.cli.DefaultParser.handleToken(DefaultParser.java:239)
	at org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:120)
	at org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:76)
	at org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:60)
	at ca.weblite.jdeploy.JDeploy.main(JDeploy.java:1145)

Is there any way to fix this issue?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
mddanishansaricommented, Sep 17, 2021

I had similar issue, you case might be different but this worked for me. I had Jansi in my JAR file, removing jansi.jar from my executable JAR helped fix it for me.

Also try to update jdeploy’s dependency shelljs version to 0.8.4

0reactions
andrii-bodnarcommented, Jul 14, 2022

@ravn thanks a lot for the detailed investigation!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support colored output from original CLI · Issue #223 - GitHub
I would like to be able to have a --colors flag when running turbo to enable colors of the CLI output, including the...
Read more >
bash - How to change the output color of echo in Linux
You can use these ANSI escape codes: Black 0;30 Dark Gray 1;30 Red 0;31 Light Red 1;31 Green 0;32 Light Green 1;32 Brown/Orange...
Read more >
Color - A command-line color library with true color support ...
A command-line color library with 16/256/True color support, universal API methods and Windows support. 中文说明. Basic color preview: basic-color. Now, 256 ...
Read more >
When should colors be used in a command line application?
When should colors be used in a command line application? When they help the readability of the content (and are not used as...
Read more >
cli-color - npm
xTerm colors (256 colors table). Not supported on Windows and some terminals. However if used in not supported environment, the closest color ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found