2 * Copyright (C) 2010 Collabora Ltd.
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 2.1 of the License, or
7 * (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library. If not, see <http://www.gnu.org/licenses/>.
18 * Philip Withnall <philip.withnall@collabora.co.uk>
25 private class Folks.Inspect.Commands.Backends : Folks.Inspect.Command
27 public override string name
29 get { return "backends"; }
32 public override string description
34 get { return "Inspect the backends loaded by the aggregator."; }
37 public override string help
41 return "backends List all known backends.\n" +
42 "backends [backend name] Display the details of the " +
43 "specified backend and list its persona stores.";
47 public Backends (Client client)
52 public override void run (string? command_string)
54 if (command_string == null)
56 /* List all the backends */
57 Collection<Backend> backends =
58 this.client.backend_store.list_backends ();
60 Utils.print_line ("%u backends:", backends.size);
63 foreach (Backend backend in backends)
64 Utils.print_line ("%s", backend.name);
69 /* Show the details of a particular backend */
71 this.client.backend_store.dup_backend_by_name (command_string);
75 Utils.print_line ("Unrecognised backend name '%s'.",
80 Utils.print_line ("Backend '%s' with %u persona stores " +
81 "(type ID, ID ('display name')):",
82 backend.name, backend.persona_stores.size ());
84 /* List the backend's persona stores */
86 backend.persona_stores.foreach ((k, v) =>
88 PersonaStore store = (PersonaStore) v;
89 Utils.print_line ("%s, %s ('%s')", store.type_id, store.id,
96 public override string[]? complete_subcommand (string subcommand)
98 /* @subcommand should be a backend name */
99 return Readline.completion_matches (subcommand,
100 Utils.backend_name_completion_cb);