Summary: | [Tracker] Add --brief for programmatic use | ||
---|---|---|---|
Product: | Gentoo Hosted Projects | Reporter: | Donnie Berkholz (RETIRED) <dberkholz> |
Component: | eselect | Assignee: | Gentoo eselect Team <eselect> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | CC: | esigra |
Priority: | High | Keywords: | Tracker |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | 214817, 292097, 292099, 292100, 292101, 292102, 292104, 292105, 292107, 292108, 292109, 292111, 292112, 292113, 292115, 292116, 292117, 292119, 292120, 292121, 292122 | ||
Bug Blocks: |
Description
Donnie Berkholz (RETIRED)
![]() This will be one of the targets for 1.2.x line. The option should be called --brief not --quiet if we follow GNU coding standards. At the moment I don't see how this could be implemented other than on a module-by-module basis. The "list" action in modules typically looks like this (from kernel.eselect, but others are similar): do_list() { targets=( $(find_targets ) ) write_list_start "Available kernel symlink targets:" if [[ -n ${targets[@]} ]] ; then local i for (( i = 0 ; i < ${#targets[@]} ; i = i + 1 )) ; do [[ ${targets[${i}]} == \ $(basename $(canonicalise ${ROOT}/usr/src/linux)) ]] && \ targets[${i}]="${targets[${i}]} $(highlight '*' )" done write_numbered_list "${targets[@]}" else write_kv_list_entry "(none found)" "" fi } Changing the output routines to suppress list headings and numbering helps a little, but the "*" for the active target is added by the module. Also, the "non found" for an empty list should be suppressed, but is output by the module. The --brief option will be available in eselect-1.2 as an experimental feature. For most modules it produces reasonable results, but YMMV. (In reply to comment #3) > Changing the output routines to suppress list headings and numbering helps a > little, but the "*" for the active target is added by the module. There's now a "highlight_marker" function that modules can call for adding the "*", and it will suppress it in brief output mode. See doc/developer-guide.txt for details. > (In reply to comment #3)
> There's now a "highlight_marker" function that modules can call for
> adding the "*", and it will suppress it in brief output mode.
> See doc/developer-guide.txt for details.
Now that eselect-1.2.3 is marked stable on all architectures, it's time to fix the modules. This bug will be used as a tracker.
The following example (from kernel.eselect) illustrates what sort of changes should be done for most modules:
Function do_list() in eselect-1.1*:
do_list() {
local i targets=( $(find_targets) )
write_list_start "Available kernel symlink targets:"
if [[ ${#targets[@]} -gt 0 ]]; then
for (( i = 0; i < ${#targets[@]}; i++ )); do
[[ ${targets[i]} = \
$(basename "$(canonicalise "${ROOT}/usr/src/linux")") ]] \
&& targets[i]="${targets[${i}]} $(highlight '*')"
done
write_numbered_list "${targets[@]}"
else
write_kv_list_entry "(none found)" ""
fi
}
and in eselect-1.2*, with changes for proper support for "brief" output mode:
do_list() {
local i targets=( $(find_targets) )
write_list_start "Available kernel symlink targets:"
for (( i = 0; i < ${#targets[@]}; i++ )); do
[[ ${targets[i]} = \
$(basename "$(canonicalise "${ROOT}/usr/src/linux")") ]] \
&& targets[i]=$(highlight_marker "${targets[i]}")
done
write_numbered_list -m "(none found)" "${targets[@]}"
}
Please note:
- use of the "highlight_marker" function which replaces explicit highlight
- use of the "-m" option of "write_numbered_list" which automatically takes
care of the empty list case
All blockers have been fixed. Closing. |