4 // Copyright (C) 2005 Novell, Inc.
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
15 // The above copyright notice and this permission notice shall be included in all
16 // copies or substantial portions of the Software.
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 public static void PrintUsageAndExit ()
36 "beagle-info: Statistics from the Beagle daemon.\n" +
37 "Web page: http://www.gnome.org/projects/beagle\n" +
38 "Copyright (C) 2004-2005 Novell, Inc.\n\n";
40 "Usage: beagle-info <OPTIONS>\n\n" +
42 " --daemon-version\t\tPrint the version of the running daemon.\n" +
43 " --status\t\t\tDisplay status of the running daemon.\n" +
44 " --index-info\t\t\tDisplay statistics of the Beagle indexes.\n" +
45 " --help\t\t\tPrint this usage message.\n";
47 Console
.WriteLine (usage
);
49 System
.Environment
.Exit (0);
52 static int Main (string[] args
)
54 if (args
.Length
== 0 || Array
.IndexOf (args
, "--help") > -1)
57 DaemonInformationRequest request
= new DaemonInformationRequest ();
58 DaemonInformationResponse response
;
61 response
= (DaemonInformationResponse
) request
.Send ();
62 } catch (Beagle
.ResponseMessageException
) {
63 Console
.WriteLine ("Could not connect to the daemon.");
67 if (Array
.IndexOf (args
, "--daemon-version") > -1)
68 Console
.WriteLine ("Daemon version: {0}", response
.Version
);
70 if (Array
.IndexOf (args
, "--status") > -1)
71 Console
.Write (response
.HumanReadableStatus
);
73 if (Array
.IndexOf (args
, "--index-info") > -1) {
74 Console
.WriteLine ("Index information:");
75 Console
.WriteLine (response
.IndexInformation
);