1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 *
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
8 *
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
13 *
14 * The Original Code is the Mozilla toolkit.
15 *
16 * The Initial Developer of the Original Code is
17 * Benjamin Smedberg <benjamin@smedbergs.us>
18 *
19 * Portions created by the Initial Developer are Copyright (C) 2004
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38 #include "nsISupports.idl"
39
40 interface nsICommandLine;
41
42 /**
43 * Handles arguments on the command line of an XUL application.
44 *
45 * Each handler is registered in the category "command-line-handler".
46 * The entries in this category are read in alphabetical order, and each
47 * category value is treated as a service contractid implementing this
48 * interface.
49 *
50 * By convention, handler with ordinary priority should begin with "m".
51 *
52 * Example:
53 * Category Entry Value
54 * command-line-handler b-jsdebug @mozilla.org/venkman/clh;1
55 * command-line-handler c-extensions @mozilla.org/extension-manager/clh;1
56 * command-line-handler m-edit @mozilla.org/composer/clh;1
57 * command-line-handler m-irc @mozilla.org/chatzilla/clh;1
58 * command-line-handler y-final @mozilla.org/browser/clh-final;1
59 *
60 * @status UNDER_REVIEW This interface is intended to be frozen, but it isn't
61 * frozen yet. Be careful!
62 * @note What do we do about localizing helpInfo? Do we make each handler do it,
63 * or provide a generic solution of some sort? Don't freeze this interface
64 * without thinking about this!
65 */
66
67 [scriptable, uuid(d4b123df-51ee-48b1-a663-002180e60d3b)]
68 interface nsICommandLineHandler : nsISupports
69 {
70 /**
71 * Process a command line. If this handler finds arguments that it
72 * understands, it should perform the appropriate actions (such as opening
73 * a window), and remove the arguments from the command-line array.
74 *
75 * @throw NS_ERROR_ABORT to immediately cease command-line handling
76 * (if this is STATE_INITIAL_LAUNCH, quits the app).
77 * All other exceptions are silently ignored.
78 */
79 void handle(in nsICommandLine aCommandLine);
80
81 /**
82 * When the app is launched with the -help argument, this attribute
83 * is retrieved and displayed to the user (on stdout). The text should
84 * have embedded newlines which wrap at 76 columns, and should include
85 * a newline at the end. By convention, the right column which contains flag
86 * descriptions begins at the 24th character.
87 */
88 readonly attribute AUTF8String helpInfo;
89 };