diff options
author | Luca Boccassi <luca.boccassi@microsoft.com> | 2020-06-19 11:26:22 +0100 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@microsoft.com> | 2020-08-19 15:30:13 +0100 |
commit | 46ad9c5378864ff3380dc119a949beeed08782cd (patch) | |
tree | 5f009edbd4313db9140100801be47da27508e489 /shell-completion | |
parent | 7b3eb5c97ec835100b2974dae035004d07b6d60c (diff) | |
download | systemd-46ad9c5378864ff3380dc119a949beeed08782cd.tar.gz |
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.
Diffstat (limited to 'shell-completion')
-rw-r--r-- | shell-completion/bash/systemctl.in | 5 | ||||
-rw-r--r-- | shell-completion/zsh/_systemctl.in | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in index fdbe32e5f7..b5bd727abf 100644 --- a/shell-completion/bash/systemctl.in +++ b/shell-completion/bash/systemctl.in @@ -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 diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in index 582d469c35..c59beb157c 100644 --- a/shell-completion/zsh/_systemctl.in +++ b/shell-completion/zsh/_systemctl.in @@ -431,6 +431,13 @@ done _values -s , "${_modes[@]}" } +(( $+functions[_systemctl_timestamp] )) || + _systemctl_timestamp() { + local -a _styles + _styles=(help pretty us µs utc us+utc µs+utc) + _values -s , "${_styles[@]}" + } + # Build arguments for "systemctl" to be used in completion. local -a _modes; _modes=("--user" "--system") # Use the last mode (they are exclusive and the last one is used). @@ -471,4 +478,5 @@ _arguments -s \ '--firmware-setup[Tell the firmware to show the setup menu on next boot]' \ '--plain[When used with list-dependencies, print output as a list]' \ '--failed[Show failed units]' \ + '--timestamp=[Change format of printed timestamps]:style:_systemctl_timestamp' \ '*::systemctl command:_systemctl_commands' |