toolkit/components/commandlines/nsICommandLineHandler.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/components/commandlines/nsICommandLineHandler.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,54 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "nsISupports.idl"
     1.9 +
    1.10 +interface nsICommandLine;
    1.11 +
    1.12 +/**
    1.13 + * Handles arguments on the command line of an XUL application.
    1.14 + *
    1.15 + * Each handler is registered in the category "command-line-handler".
    1.16 + * The entries in this category are read in alphabetical order, and each
    1.17 + * category value is treated as a service contractid implementing this
    1.18 + * interface.
    1.19 + *
    1.20 + * By convention, handler with ordinary priority should begin with "m".
    1.21 + *
    1.22 + * Example:
    1.23 + * Category             Entry          Value
    1.24 + * command-line-handler b-jsdebug      @mozilla.org/venkman/clh;1
    1.25 + * command-line-handler c-extensions   @mozilla.org/extension-manager/clh;1
    1.26 + * command-line-handler m-edit         @mozilla.org/composer/clh;1
    1.27 + * command-line-handler m-irc          @mozilla.org/chatzilla/clh;1
    1.28 + * command-line-handler y-final        @mozilla.org/browser/clh-final;1
    1.29 + *
    1.30 + * @note What do we do about localizing helpInfo? Do we make each handler do it,
    1.31 + *       or provide a generic solution of some sort? Don't freeze this interface
    1.32 + *       without thinking about this!
    1.33 + */
    1.34 +
    1.35 +[scriptable, uuid(d4b123df-51ee-48b1-a663-002180e60d3b)]
    1.36 +interface nsICommandLineHandler : nsISupports
    1.37 +{
    1.38 +  /**
    1.39 +   * Process a command line. If this handler finds arguments that it
    1.40 +   * understands, it should perform the appropriate actions (such as opening
    1.41 +   * a window), and remove the arguments from the command-line array.
    1.42 +   *
    1.43 +   * @throw NS_ERROR_ABORT to immediately cease command-line handling
    1.44 +   *        (if this is STATE_INITIAL_LAUNCH, quits the app).
    1.45 +   *        All other exceptions are silently ignored.
    1.46 +   */
    1.47 +  void handle(in nsICommandLine aCommandLine);
    1.48 +
    1.49 +  /**
    1.50 +   * When the app is launched with the -help argument, this attribute
    1.51 +   * is retrieved and displayed to the user (on stdout). The text should
    1.52 +   * have embedded newlines which wrap at 76 columns, and should include
    1.53 +   * a newline at the end. By convention, the right column which contains flag
    1.54 +   * descriptions begins at the 24th character.
    1.55 +   */
    1.56 +  readonly attribute AUTF8String helpInfo;
    1.57 +};

mercurial