Commit Graph
8 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek ad894f24df bash-completion: use improved filtering to make things faster
(cherry picked from commit 372b221166)
2014-10-30 00:18:35 -04:00
Zbigniew Jędrzejewski-Szmek b5d7c81b89 bash-completion: rework startable/restartable units once more
I tried to use 'systemctl --all list-units' to filter unit files, but
this always filters out unit files which are not loaded. We want to complete
systemctl start with those units too, so this approach is not going to work.

New version is rather slow, but hopefully correct.

(cherry picked from commit 9ff8af5460)
2014-10-30 00:03:38 -04:00
Zbigniew Jędrzejewski-Szmek 54a21e301c shell-completion: propose templates for disable/[re]enable/[re]start
Templates can be [re]enabled, on their own if the have DefaultInstance set,
and with an instance suffix in all cases. Propose just the template name
ending in @, to underline the instance suffix may have to be appended.

Likewise for start/restart.

This means that sometimes superflous units that one will not really
want to operate on will be proposed, but this seems better than
proposing a very incomplete set of names.

https://bugs.freedesktop.org/show_bug.cgi?id=66912
(cherry picked from commit e9a19bd882)
2014-10-26 18:23:47 -04:00
Zbigniew Jędrzejewski-Szmek 26df33449f shell-completion: fix completion of inactive units
Units which not loaded were not proposed properly. OTOH, we should
filter units from get-unit-files by their state if they are currently
loaded. Bring zsh completions in line with bash completion, the same
logic should be used in both implementations.

https://bugzilla.redhat.com/show_bug.cgi?id=1024379
https://bugzilla.redhat.com/show_bug.cgi?id=790768
https://bugs.freedesktop.org/show_bug.cgi?id=84720
(cherry picked from commit f29c77bc01)
2014-10-26 18:23:47 -04:00
Dave Reisner 1016e13e6a completion: filter templates from restartable units
Since c6a373a263, we might encounter unit templates via the
'list-units' verb. These aren't restartable (and we throw errors), so
make sure they're filtered out of the completion options.

fixes downstream bug: https://bugs.archlinux.org/task/41719

(cherry picked from commit ec15977a3c)
2014-10-26 18:23:46 -04:00
Eric Cook ab5543f5af shell-completion: prevent mangling unit names (bash)
This fixes the issue noted by Zbigniew in most cases.
if a unit's name is enclosed in single quotes completion still
will not happen after the first `\'.

https://bugs.freedesktop.org/show_bug.cgi?id=78388
(cherry picked from commit c317a1a19c)
2014-10-26 18:23:46 -04:00
Zbigniew Jędrzejewski-Szmek 8c2e21cf4a bash-completion: use list-unit-files to get "all" units
I think that it is better to return good results slightly more slowly,
than partial quickly. Also reading from disk seems fast enough. Even
the delay on first try with completely cold cache is acceptable.

This is just for bash, 'cause zsh was already doing this.

https://bugzilla.redhat.com/show_bug.cgi?id=790768
(cherry picked from commit c6a373a263)
2014-10-26 18:23:46 -04:00
Zbigniew Jędrzejewski-Szmek c2e540291d shell-completion: restore completion for -p
It was broken since systemd was moved out of /bin.

For zsh it was never there.

(cherry picked from commit c0a67aef31)

Conflicts:
	Makefile.am
2014-10-26 18:23:46 -04:00