Libelektra: kdb: Support Non-Colored Output

Created on 16 Jan 2017  Â·  1Comment  Â·  Source: ElektraInitiative/libelektra

Problem Description

I decided to review pull request #1281. Since I use fish, a shell that currently does not support command completion for kdb, I created a very basic completion file called kdb.fish. Currently this file looks like this:

function __fish_kdb_complete
  kdb | awk '/Known commands are:/,empty' | awk '{if(NR>1)print}'
end

complete --command kdb --exclusive --arguments '(__fish_kdb_complete)'

. The problem with the completion command is, that kdb prints escape sequences to color its output. These escape sequences are currently also part of the completion:

completion

. I tried to call kdb with the option -C to disable color output, but unfortunately that does not work:

The command kdb -C is not known
…

. As far as I can remember the Bash completion command has the same problem. Is there an easy way to disable colored out for the command kdb? If there is none, could we please add an option to disable the colored output.

System Information

  • Elektra Version: master
  • Operating System: macOS 10.12.2
enhancement question usability

Most helpful comment

Thanks for reporting!

I decided to review pull request #1281.

You should keep in mind that this PR is more about requirement gathering than something finished. Maybe you can also give hints what would be needed for the fish shell.

The problem with the completion command is, that kdb prints escape sequences to color its output.
Is there an easy way to disable colored out for the command kdb?

It is difficult to fix because unknown commands abort before command-line parsing starts. Thus -C has no effect in these early-abort situations.

If there is none, could we please add an option to disable the colored output.

I fixed it with a new command list-commands which supports listing the commands without explanations and also supports -0 and -C.

>All comments

Thanks for reporting!

I decided to review pull request #1281.

You should keep in mind that this PR is more about requirement gathering than something finished. Maybe you can also give hints what would be needed for the fish shell.

The problem with the completion command is, that kdb prints escape sequences to color its output.
Is there an easy way to disable colored out for the command kdb?

It is difficult to fix because unknown commands abort before command-line parsing starts. Thus -C has no effect in these early-abort situations.

If there is none, could we please add an option to disable the colored output.

I fixed it with a new command list-commands which supports listing the commands without explanations and also supports -0 and -C.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mpranj picture mpranj  Â·  3Comments

mpranj picture mpranj  Â·  3Comments

mpranj picture mpranj  Â·  3Comments

markus2330 picture markus2330  Â·  4Comments

markus2330 picture markus2330  Â·  4Comments