Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 558082

Summary: rc-config: make output easier to parse
Product: Gentoo Hosted Projects Reporter: Patrick Lauer <patrick>
Component: eselectAssignee: Gentoo eselect Team <eselect>
Status: RESOLVED WORKSFORME    
Severity: normal CC: erkiferenc, ysottre
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Patrick Lauer gentoo-dev 2015-08-18 12:08:37 UTC
$ rc-config list default
Init scripts to be started by runlevel default
  cpufrequtils
  mdraid
  named

this output is needlessly indented with spaces, and has a first line that gets in the way of automated parsing.

It'd be nice to have a simplified output that has no random spaces (tabs for indentation) and is left-aligned so that automation tools can easily parse the output.  ( --column ?)

Additionally an 'exists' verb might be very useful:

rc-config exists iptables
Comment 1 Andrew Miller 2015-08-18 13:22:01 UTC
>--column ?

--brief is used in other gentoo tools, like eselect
Comment 2 Ferenc Erki 2015-08-18 16:23:45 UTC
Looks like rc-config is only a symlink to eselect, so the --brief option is there for rc-config too.

The difference between the two outputs seems to only be the lack of "Available init scripts" header in the brief version. Maybe it can be extended to also format the output in a bit more machine-friendly way.
Comment 3 Andrew Miller 2015-08-19 04:22:10 UTC
(In reply to Ferenc Erki from comment #2)
> The difference between the two outputs seems to only be the lack of
> "Available init scripts" header in the brief version. Maybe it can be
> extended to also format the output in a bit more machine-friendly way.

It could definitely be improved. There's another command:

eselect --brief news list

whose output needs parsing to be used in an external script.

I've been working on adding unicode support to eselect, I'd be happy to help.
Comment 4 William Hubbs gentoo-dev 2015-08-19 16:38:20 UTC
rc-config is not part of OpenRC; fixing assignee.
Comment 5 Ulrich Müller gentoo-dev 2015-08-19 17:13:31 UTC
As was noted previously, use the --brief option to suppress unnecessary output.