Commit Graph

62 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 341992081b shell-completion: fix systemctl set/unset/import-environment
unset-environment is completed with variable names in the environment block.
set-environment the same, but suffixed with "=".
import-environment is completed with variable names in the client environment.
2021-01-08 20:01:40 +01:00
Yu Watanabe db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Luca Boccassi 46ad9c5378 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.
2020-08-19 15:30:13 +01:00
Jouke Witteveen 1cabd2d0c5 systemctl: hide first column with --plain instead of --no-legend
Hiding the first column, which may contain bullet circles, with --no-legend
is undocumented and potentially unexpected. On the other hand, not printing
bullet circles with --plain is documented so hiding the column with that
switch is sensible.

The combination "--full --no-legend --no-pager --plain" is appropriate for
automated processing of systemctl output.
2020-04-17 19:15:49 +02:00
Yu Watanabe e2268fa437 bash-completion: do not ellipsize machine name 2020-01-10 12:29:02 +09:00
Yu Watanabe 4171837be6 bash-completion: move shell-completion for log-level or friends to systemctl 2019-12-21 19:23:02 +01:00
Frantisek Sumsal cec82cb943 bash-completion: correctly react to an unescaped unit name 2019-05-30 14:30:59 +02:00
Frantisek Sumsal babf4f68fc bash-completion: process only non-template units for systemctl isolate 2019-04-26 08:05:05 +02:00
Frantisek Sumsal 9521d5582b bash-completion: unify indentation 2019-04-24 18:03:30 +02:00
Frantisek Sumsal 72c9177db2 bash-completion: properly autocomplete escaped unit names 2019-04-24 18:03:15 +02:00
Zbigniew Jędrzejewski-Szmek 843cfcb15c shell-completion: use 4 space indentation too
The same as in other places, indentation levels were all over the place.
2019-04-12 08:34:44 +02:00
Yu Watanabe ca66b69d5b bash-completion: also suggest units in reloading or activating
Closes #11942.
2019-03-12 11:25:26 +01:00
Yu Watanabe 2e68a49dc8 bash-completion: systemctl: use --output=help to show suggestions 2018-12-14 02:33:21 +09:00
Lennart Poettering 8e04444385 journalctl: port JSON output mode to new JSON API
Also, while we are at it, beef it up, by adding json-seq support (i.e.
https://tools.ietf.org/html/rfc7464). This is particularly useful in
conjunction with jq's --seq switch.
2018-10-11 17:25:27 +02:00
Yu Watanabe f28255e2d5 bash-completion: systemctl: re-implement __filter_units_by_properties()
This also unifies __filter_units_by_property() and
__filter_units_by_properties(), and makes completion for 'restart',
'reload' or 'stop' show more candidates.
2018-09-12 14:17:22 +09:00
Lennart Poettering 96b2fb93c5 tree-wide: beautify remaining copyright statements
Let's unify an beautify our remaining copyright statements, with a
unicode ©. This means our copyright statements are now always formatted
the same way. Yay.
2018-06-14 10:20:21 +02:00
Emil Velikov 9b536b1af2 shell-completion: systemctl: do not list template units in {re,}start
Template units lacking DefaultInstance cannot be enabled/disabled or
started/restarted.

By adding DefaultInstance the unit can be enabled/disabled but it
still cannot be started/restarted.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-06-11 17:15:12 +01:00
Emil Velikov 98476dc8b2 shell-completion: systemctl: pass current word to all list_unit*
Earlier patch added the current word to the performance critical paths.
Here we add it to every place, for consistency sake.

Suggested-by: Yu Watanabe (yuwata)
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2018-06-11 17:09:58 +01:00
Emil Velikov c839b729c5 bash-completion: systemctl: pass current partial unit to list-unit*
Pass the partial name of the unit file to list-unit-files and
list-units. This allows for faster completion, since systemctl does
not need to list all the unit files.

For reference:
 - time systemctl list-unit-files -> ~200ms
 - time systemctl list-unit-files netctl* -> ~15ms
 - time systemctl list-units -> ~5ms
 - time systemctl list-units netctl* -> ~5ms

While the list-units time itself is unaffected, now a shorter list is
produced. Thus as we pass it to `systemctl show' (via
__filter_units_by_properties) the execution time will be decreased even
further.

v2: Update list-units hunk in commit message, add quotes around $2*
v3: Remove funky indentation, quote all $cur instances

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-06-11 17:09:55 +01:00
Emil Velikov aedd48160f bash-completion: systemctl: use systemctl --no-pager
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-06-11 17:09:53 +01:00
Yu Watanabe aea447c9f8 bash-completion: also suggest template unit files
Fixes #9041.
2018-05-28 18:15:00 +09:00
Yu Watanabe 4f150c407f bash-completion: suggest bus properties instead of configuration items for 'systemctl -p'
Closes #5137.
2018-05-28 18:13:52 +09:00
Zbigniew Jędrzejewski-Szmek 11a1589223 tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
2018-04-06 18:58:55 +02:00
Mario Limonciello e68c79db91 Rename suspend-to-hibernate to suspend-then-hibernate
Per some discussion with Gnome folks, they would prefer this name
as it's more descriptive of what's happening.
2018-03-28 15:11:10 -05:00
Mario Limonciello c58493c00a Introduce suspend-to-hibernate (#8274)
Suspend to Hibernate is a new sleep method that invokes suspend
for a predefined period of time before automatically waking up
and hibernating the system.

It's similar to HybridSleep however there isn't a performance
impact on every suspend cycle.

It's intended to use with systems that may have a higher power
drain in their supported suspend states to prevent battery and
data loss over an extended suspend cycle.

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
2018-03-08 14:17:33 +01:00
Yu Watanabe 035dd8c0a3 bash-completion: systemctl: add missing options and verbs 2018-01-10 23:18:16 +09:00
Zbigniew Jędrzejewski-Szmek 7059062c2f Add SPDX license headers to shell completion scripts 2017-11-19 19:08:15 +01:00
Yu Watanabe 6bda23dd6a bash-completion: use the first argument instead of the global variable (#6457)
Without this fix:

$ systemctl start <tab>
Display all 135 possibilities? (y or n)
$ __get_startable_units --system | wc -l
224

the number of the suggestions are quite different, as __get_startable_units --system does
not filter already started units. With this fix,

$ systemctl start <tab>
Display all 135 possibilities? (y or n)
$ __get_startable_units --system | wc -l
123
$ __get_template_names --system | wc -l
12

the number of the suggestions matches one the function returns.
For consistency with the other internal functions, it should use the first argument
instead of the global variable $mode.

[zj: add commit message to make it sound like we know what we're doing]
2017-07-27 07:22:54 -04:00
Lucas Werkmeister 0f8158bd26 shell-completion: add systemctl revert (#6042)
The `systemctl revert` command was added in v230 (commit 344ca7556b),
but was missing from the shell completion specifications.

Fixes #5978.
2017-05-29 15:01:01 +02:00
Ian Wienand 7e563bfc97 Add short-iso-precise for journalctl output (#5884)
This adds a short-iso-precise option for journalctl output.  It is similar to
short-iso, but includes microseconds.
2017-05-07 20:23:49 -04:00
Zbigniew Jędrzejewski-Szmek bef19548a2 systemctl: restore --failed (#5198)
'systemctl --failed' is an extremely common operation and it's nice to have
a shortcut for it.

Revert "man: don't document systemctl --failed" and add the option back to
systemctl's help and shell completion scripts.

This reverts commit 036359ba8d.
2017-02-02 00:23:46 +01:00
Jan Synacek 0067c7b29a bash-completion: add support for --now (#5155) 2017-01-25 07:44:04 -05:00
Zbigniew Jędrzejewski-Szmek 99171d2fdf shell-completion: redirect all errors from systemctl to /dev/null
Completion scripts should not generate errors, ever.

https://bugzilla.redhat.com/show_bug.cgi?id=1409649
2017-01-11 16:37:34 -05:00
Yu Watanabe c07c80bc96 bash-completion: systemctl: use local variables 2016-09-14 15:22:45 +09:00
Yu Watanabe b1bdb6496c bash-completion: systemctl: do not pass masked or not-found units to filter
Also, add new function __filter_units_by_properties() for filtering units by
multiple properties, and make __get_startable_units() use it.

fixes #4114
2016-09-09 16:20:05 +09:00
Lennart Poettering 29a753df76 journalctl: add new output mode "short-full" (#3880)
This new output mode formats all timestamps using the usual format_timestamp()
call we use pretty much everywhere else. Timestamps formatted this way are some
ways more useful than traditional syslog timestamps as they include weekday,
month and timezone information, while not being much longer. They are also not
locale-dependent. The primary advantage however is that they may be passed
directly to journalctl's --since= and --until= switches as soon as #3869 is
merged.

While we are at it, let's also add "short-unix" to shell completion.
2016-08-03 19:45:07 -04:00
Zbigniew Jędrzejewski-Szmek ed1190498f tree-wide: remove uses of --failed
It has been replaced by --state=failed.
2016-05-08 20:27:33 -04:00
Lennart Poettering aabf5d4243 systemctl: rename "reload-or-try-restart" verb to "try-reload-or-restart"
But also keep the old name as (undocumented) compatibility around.

The reload-or-try-restart was documented to be a NOP if the unit is not running, since the previous commits this is
also implemented. The old name suggests that the "try" logic only applies to restarting. Fix this, by moving the "try-"
to the front, to indicate that the whole option is a NOP if the service isn't running.
2016-01-28 18:57:04 +01:00
Evgeny Vereshchagin c2af810150 bash-completion: list valid signal names
this is a follow-up for commit 18540892d1
2015-11-24 16:05:42 +00:00
Zbigniew Jędrzejewski-Szmek 36b4a7ba55 Remove snapshot unit type
Snapshots were never useful or used for anything. Many systemd
developers that I spoke to at systemd.conf2015, didn't even know they
existed, so it is fairly safe to assume that this type can be deleted
without harm.

The fundamental problem with snapshots is that the state of the system
is dynamic, devices come and go, users log in and out, timers fire...
and restoring all units to some state from the past would "undo"
those changes, which isn't really possible.

Tested by creating a snapshot, running the new binary, and checking
that the transition did not cause errors, and the snapshot is gone,
and snapshots cannot be created anymore.

New systemctl says:
Unknown operation snapshot.
Old systemctl says:
Failed to create snapshot: Support for snapshots has been removed.

IgnoreOnSnaphost settings are warned about and ignored:
Support for option IgnoreOnSnapshot= has been removed and it is ignored

http://lists.freedesktop.org/archives/systemd-devel/2015-November/034872.html
2015-11-10 19:33:06 -05:00
Franck Bui d82fabdb7f bash-completion: add minimal support fpr 'set-property' command
'set-property' was missing from the list of known command.

Also a list of unit names will be proposed as next argument.

However no support on property names is provided since it would
require a hard coded list of them.
2015-11-04 08:42:16 +01:00
Evgeny Vereshchagin 93557fcb5d shell-completion: systemctl: show completions for `user` in `global` mode 2015-10-30 04:55:32 +03:00
Zbigniew Jędrzejewski-Szmek 4ed2f1b1f1 bash-completion: remove one more sort and sub-shell
{} is preferred to (), because the first is just grouping, while the
second invokes a separate shell.
2015-09-28 17:23:53 -04:00
Zbigniew Jędrzejewski-Szmek 840b2c0e77 shell-completion: use systemctl --state=help
This way completion lists should stay up to date.

Also use systemctl -t help to list types in zsh, as was already
done in bash.
2015-09-28 15:10:03 -04:00
Evgeny Vereshchagin 3a221b5df8 shell-completion: update systemctl bash completion
Many new options have been added since the bash completion was last
updated.
2015-09-04 23:04:10 +03:00
Evgeny Vereshchagin 17e98b9177 shell-completion: add `failed` state to --state compwords 2015-08-28 00:36:02 +00:00
Evgeny Vereshchagin adb0c25eb6 bash-completion: generate unit type list from systemctl -t help option 2015-08-16 14:53:21 +00:00
Zbigniew Jędrzejewski-Szmek 903e7c37ca Use "new" --job-mode= option in more places
--irreversible/--ignore-dependencies/--fail are deprececated since 4dc5b821ae.

Also add shell completions for --jobs-mode.
2015-05-18 01:08:09 -04:00
Zbigniew Jędrzejewski-Szmek 7b742b3130 shell-completion: systemctl switch-root verb
The completion is rudimentary (all files). I think this is OK since
this is used so rarely. But not having it proposed at all is annoying.
2015-04-08 11:28:45 -04:00
Jan Janssen 5bdf22430e logind,systemctl: add reboot to EFI firmware support 2015-04-07 18:51:45 +02:00