systemctl: add --timestamp to change timestamp print format

Timestamps for unit start/stop are recorded with microsecond granularity,
but status and show truncate to second granularity by default.
Add a --timestamp=pretty|us|utc option to allow including the microseconds
or to use the UTC TZ to all timestamps printed by systemctl.
This commit is contained in:
Luca Boccassi
2020-08-19 15:30:13 +01:00
parent 7b3eb5c97e
commit 46ad9c5378
4 changed files with 58 additions and 12 deletions
+4 -1
View File
@@ -127,7 +127,7 @@ _systemctl () {
--quiet -q --system --user --version --runtime --recursive -r --firmware-setup
--show-types -i --ignore-inhibitors --plain --failed --value --fail --dry-run --wait'
[ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --job-mode --root
--preset-mode -n --lines -o --output -M --machine --message'
--preset-mode -n --lines -o --output -M --machine --message --timestamp'
)
if __contains_word "--user" ${COMP_WORDS[*]}; then
@@ -176,6 +176,9 @@ _systemctl () {
--machine|-M)
comps=$( __get_machines )
;;
--timestamp)
comps='pretty us µs utc us+utc µs+utc'
;;
esac
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
return 0