Skip to content

Commit

Permalink
Merge pull request #55 from vincentdephily/process_tree
Browse files Browse the repository at this point in the history
Show process tree and skip rows

Fixes #30
  • Loading branch information
vincentdephily authored Oct 31, 2024
2 parents 77a9ee6 + 0f8c759 commit 0bbb248
Show file tree
Hide file tree
Showing 16 changed files with 720 additions and 306 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# unreleased

## New features

* `predict` now displays emerge proces tree instead of just top proces
- Bevahvior configurable with `--pdepth`, `--pwidth`
- Format is a bit nicer and more colorful
* Display a placeholder for skipped rows, configurable with `--showskip`

## Bug fixes

* Don't display child emerge processes as root ones
* Fix off by one upper bound for some cli args
* Allow alignment of wider columns

# 0.7.1 2024-09-30

Maintenance release.
Expand Down
28 changes: 17 additions & 11 deletions completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ _emlop() {

case "${cmd}" in
emlop)
opts="log predict stats accuracy -f -t -H -o -F -v -h -V --from --to --header --duration --date --utc --color --output --logfile --help --version"
opts="log predict stats accuracy -f -t -H -o -F -v -h -V --from --to --header --showskip --duration --date --utc --color --output --logfile --help --version"
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand All @@ -36,7 +36,7 @@ _emlop() {
--from|--to|-f|-t)
COMPREPLY=($(compgen -W "1h 1d 1w 1m 1h $(date -Is)" "${cur}"))
;;
--header|-H)
--header|-H|--showskip)
COMPREPLY=($(compgen -W "yes no" "${cur}"))
;;
--duration)
Expand Down Expand Up @@ -64,7 +64,7 @@ _emlop() {
return 0
;;
emlop__accuracy)
opts="[search]... -e -s -n -f -t -H -o -F -v -h --exact --show --last --avg --limit --from --to --header --duration --date --utc --color --output --logfile --help"
opts="[search]... -e -s -n -f -t -H -o -F -v -h --exact --show --last --avg --limit --from --to --header --showskip --duration --date --utc --color --output --logfile --help"
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand All @@ -73,7 +73,7 @@ _emlop() {
--from|--to|-f|-t)
COMPREPLY=($(compgen -W "1h 1d 1w 1m 1h $(date -Is)" "${cur}"))
;;
--header|-H)
--header|-H|--showskip)
COMPREPLY=($(compgen -W "yes no" "${cur}"))
;;
--duration)
Expand Down Expand Up @@ -117,7 +117,7 @@ _emlop() {
return 0
;;
emlop__log)
opts=" [search]... -N -n -s -e -f -t -H -o -F -v -h --starttime --first --last --show --exact --from --to --header --duration --date --utc --color --output --logfile --help"
opts=" [search]... -N -n -s -e -f -t -H -o -F -v -h --starttime --first --last --show --exact --from --to --header --showskip --duration --date --utc --color --output --logfile --help"
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand All @@ -126,8 +126,8 @@ _emlop() {
--from|--to|-f|-t)
COMPREPLY=($(compgen -W "1h 1d 1w 1m 1h $(date -Is)" "${cur}"))
;;
--header|-H)
COMPREPLY=($(compgen -W "yes no ${opts}" "${cur}"))
--header|-H|--showskip)
COMPREPLY=($(compgen -W "yes no" "${cur}"))
;;
--duration)
COMPREPLY=($(compgen -W "hms secs hmsfixed human" "${cur}"))
Expand Down Expand Up @@ -167,7 +167,7 @@ _emlop() {
return 0
;;
emlop__predict)
opts="-s -N -n -f -t -H -o -F -v -h --show --first --last --tmpdir --resume --unknown --avg --limit --from --to --header --duration --date --utc --color --output --logfile --help"
opts="-s -N -n -f -t -H -o -F -v -h --show --first --last --tmpdir --resume --unknown --avg --limit --from --to --header --showskip --duration --date --utc --color --output --pdepth --pwidth --logfile --help"
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand All @@ -176,7 +176,7 @@ _emlop() {
--from|--to|-f|-t)
COMPREPLY=($(compgen -W "1h 1d 1w 1m 1h $(date -Is)" "${cur}"))
;;
--header|-H)
--header|-H|--showskip)
COMPREPLY=($(compgen -W "yes no" "${cur}"))
;;
--duration)
Expand All @@ -191,6 +191,12 @@ _emlop() {
--color)
COMPREPLY=($(compgen -W "yes no auto" "${cur}"))
;;
--pwidth)
COMPREPLY=($(compgen -W "10 20 40 80 160" "${cur}"))
;;
--pdepth)
COMPREPLY=($(compgen -W "0 1 3 5 7 99" "${cur}"))
;;
--output|-o)
COMPREPLY=($(compgen -W "tab columns auto" "${cur}"))
;;
Expand Down Expand Up @@ -225,7 +231,7 @@ _emlop() {
return 0
;;
emlop__stats)
opts="[search]... -s -g -e -f -t -H -o -F -v -h --show --groupby --exact --avg --limit --from --to --header --duration --date --utc --color --output --logfile --help"
opts="[search]... -s -g -e -f -t -H -o -F -v -h --show --groupby --exact --avg --limit --from --to --header --showskip --duration --date --utc --color --output --logfile --help"
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand All @@ -234,7 +240,7 @@ _emlop() {
--from|--to|-f|-t)
COMPREPLY=($(compgen -W "1h 1d 1w 1m 1h $(date -Is)" "${cur}"))
;;
--header|-H)
--header|-H|--showskip)
COMPREPLY=($(compgen -W "yes no" "${cur}"))
;;
--duration)
Expand Down
3 changes: 3 additions & 0 deletions completion.fish
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ complete -c emlop -f
complete -c emlop -s f -l from -d 'Only parse log entries after <date>' -x -a "{1y 'One year ago',1m 'One month ago',1w 'One week ago',1d 'One day ago',1h 'One hour ago',(date -Is) 'Exact date'}"
complete -c emlop -s t -l to -d 'Only parse log entries before <date>' -x -a "{1y 'One year ago',1m 'One month ago',1w 'One week ago',1d 'One day ago',1h 'One hour ago',(date -Is) 'Exact date'}"
complete -c emlop -s H -l header -d 'Show table header' -f -a "yes no"
complete -c emlop -l showskip -d 'Show skipped rows' -f -a "yes no"
complete -c emlop -l duration -d 'Output durations in different formats' -x -a "hms hmsfixed human secs"
complete -c emlop -l date -d 'Output dates in different formats' -x -a "ymd ymdhms ymdhmso rfc3339 rfc2822 compact unix"
complete -c emlop -l utc -d 'Parse/display dates in UTC instead of local time' -f -a "yes no"
Expand Down Expand Up @@ -34,6 +35,8 @@ complete -c emlop -n "__fish_seen_subcommand_from predict" -l resume -d 'Use mai
complete -c emlop -n "__fish_seen_subcommand_from predict" -l unknown -d 'Assume unkown packages take <secs> seconds to merge' -x -a "0 5 10 20 60"
complete -c emlop -n "__fish_seen_subcommand_from predict" -l avg -d 'Select function used to predict durations' -x -a "arith median weighted-arith weighted-median"
complete -c emlop -n "__fish_seen_subcommand_from predict" -l limit -d 'Use the last <num> merge times to predict durations' -x -a "1 5 20 999"
complete -c emlop -n "__fish_seen_subcommand_from predict" -l pwidth -d 'Maximum width of emerge proces comandline' -x -a "10 20 40 80 160"
complete -c emlop -n "__fish_seen_subcommand_from predict" -l pdepth -d 'Maximum depth of emerge proces tree' -x -a "0 1 3 5 7 99"

complete -c emlop -n "__fish_seen_subcommand_from stats" -s s -l show -d 'Show (p)ackages, (t)otals, (s)yncs, and/or (a)ll' -x -a "ptsa"
complete -c emlop -n "__fish_seen_subcommand_from stats" -s g -l groupby -d 'Group by (y)ear, (m)onth, (w)eek, (d)ay, (n)one' -x -a "year month week day none"
Expand Down
7 changes: 7 additions & 0 deletions completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ _emlop() {
'--to=[Only parse log entries before <date>]:date: ' \
'-H+[Show table header]' \
'--header=[Show table header]' \
'--showskip=[Show skipped rows]' \
'--duration=[Output durations in different formats]:format: ' \
'--date=[Output dates in different formats]:format: ' \
'--utc=[Parse/display dates in UTC instead of local time]' \
Expand Down Expand Up @@ -47,6 +48,7 @@ _emlop() {
'--to=[Only parse log entries before <date>]:date: ' \
'-H+[Show table header]' \
'--header=[Show table header]' \
'--showskip=[Show skipped rows]' \
'--duration=[Output durations in different formats]:format: ' \
'--date=[Output dates in different formats]:format: ' \
'--utc=[Parse/display dates in UTC instead of local time]' \
Expand Down Expand Up @@ -81,12 +83,15 @@ _emlop() {
'--to=[Only parse log entries before <date>]:date: ' \
'-H+[Show table header]' \
'--header=[Show table header]' \
'--showskip=[Show skipped rows]' \
'--duration=[Output durations in different formats]:format: ' \
'--date=[Output dates in different formats]:format: ' \
'--utc=[Parse/display dates in UTC instead of local time]' \
'--color=[Enable color (yes/no/auto)]' \
'-o+[Ouput format (columns/tab/auto)]:format: ' \
'--output=[Ouput format (columns/tab/auto)]:format: ' \
'--pwidth=[Maximum width of emerge proces comandline]'
'--pdepth=[Maximum depth of emerge proces tree]'
'-F+[Location of emerge log file]:file: ' \
'--logfile=[Location of emerge log file]:file: ' \
'*-v[Increase verbosity (can be given multiple times)]' \
Expand All @@ -107,6 +112,7 @@ _emlop() {
'--to=[Only parse log entries before <date>]:date: ' \
'-H+[Show table header]' \
'--header=[Show table header]' \
'--showskip=[Show skipped rows]' \
'--duration=[Output durations in different formats]:format: ' \
'--date=[Output dates in different formats]:format: ' \
'--utc=[Parse/display dates in UTC instead of local time]' \
Expand Down Expand Up @@ -136,6 +142,7 @@ _emlop() {
'--to=[Only parse log entries before <date>]:date: ' \
'-H+[Show table header]' \
'--header=[Show table header]' \
'--showskip=[Show skipped rows]' \
'--duration=[Output durations in different formats]:format: ' \
'--date=[Output dates in different formats]:format: ' \
'--utc=[Parse/display dates in UTC instead of local time]' \
Expand Down
3 changes: 3 additions & 0 deletions emlop.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# header = true
# color = "yes"
# output = "columns"
# showskip = true
[log]
# show = "mus"
# starttime = true
Expand All @@ -21,6 +22,8 @@
# limit = 20
# unknown = 300
# tmpdir = ["/foo", "/bar"]
# pwidth = 60
# pdepth = 3
[stats]
# show = "pts"
# avg = "arith"
Expand Down
Loading

0 comments on commit 0bbb248

Please sign in to comment.