[systemd-devel] List all available units

Lennart Poettering lennart at poettering.net
Fri Aug 10 07:27:51 PDT 2012


On Thu, 09.08.12 09:39, Václav Pavlín (vpavlin at redhat.com) wrote:

> > If we present the user with a list like this we probably should show a
> > tree view of some kind since the unit file getty at .service might get
> > instantiated a couple of times as "getty at tty1.service" and so on, and
> > hence is in a tree-like relationship. 
> 
> I like the idea of the tree view, but I cannot imagine how it can help
> to solve autocompletion problem. If I get it right, getty at .service is
> template file, which cannot be manually instantiated, so it can be
> omitted from the output (User cannot do anything with it, right?). On
> the other hand, getty at tty1.service is an instance, which can be stopped,
> restarted etc., and it will be listed in list-units output (and then in
> merged output of new systemctl verb as well).

OK, so, let's focus on the auto completion thing for noiw, and maybe
revisit later if we want to have an additional verb to provide users
with the "full" list of services and service files.

I'd suggest implementing a new verb "complete" or so, that would work
like this:

systemctl complete enable foo

invoking this would simply output a new-line separated lists of all unit
files which can be enabled (i.e. excluding static ones, and so on) that
begin with "foo".

systemctl complete status

would output the list of loaded units *and* files. Since only two params
are specified it would show all those units/files, wouldn't do any
prefix matching.

And similar for the other commands.

Then, we could update the completion logic for bash to just invoke the
right call.

I hope this makes sense?

systemctl complete should probably be considered a hidden feature, so
not show up in --help or in the man page.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list