Adding Command Line Help for Custom Application
-
- Posts: 18
- Joined: December 27th, 2005, 9:20 am
Adding Command Line Help for Custom Application
Given an extension 'myapp', I would like the help for it to be included with the other firefox help.
e.g.
$ firefox -h
Usage: /urs/lib/firefox/firefox-bin [ options ... ] [URL]
where options include:
X11 options
--display=DISPLAY X display to use
<chop/>
-jsconsole Open the JavaScript console.
-browser Open a browser window.
-myapp "name=value id=info" Open the My App application
e.g.
$ firefox -h
Usage: /urs/lib/firefox/firefox-bin [ options ... ] [URL]
where options include:
X11 options
--display=DISPLAY X display to use
<chop/>
-jsconsole Open the JavaScript console.
-browser Open a browser window.
-myapp "name=value id=info" Open the My App application
-
- Posts: 4019
- Joined: November 16th, 2003, 3:05 am
- Location: Russia, Moscow
Implement an nsICommandLineHandler?
-
- Posts: 18
- Joined: December 27th, 2005, 9:20 am
Hmmm.
I already have a command line handler for my application.
Some options, notably -h and -help, prevent the command line handler from being called.
If I use -helper (an option I made up) then I can get most of the behavior I am looking for (as you suggested).
What I am looking for, I think, is an enhancement for the special options (I think help is the only one).
What I would like to happen:
When the -h or -help options are used then print the helpInfo property of the command line handler.
I already have a command line handler for my application.
Some options, notably -h and -help, prevent the command line handler from being called.
If I use -helper (an option I made up) then I can get most of the behavior I am looking for (as you suggested).
What I am looking for, I think, is an enhancement for the special options (I think help is the only one).
What I would like to happen:
When the -h or -help options are used then print the helpInfo property of the command line handler.
-
- Posts: 4019
- Joined: November 16th, 2003, 3:05 am
- Location: Russia, Moscow
nsICommandLineHandler is an interface. Link was the <a> element around the "nsICommandLineHandler" word in my first reply. It pointed to the helpInfo attribute.
If you know about helpInfo, I am afraid I don't understand what your problem is:
If you know about helpInfo, I am afraid I don't understand what your problem is:
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;
-
- Posts: 18
- Joined: December 27th, 2005, 9:20 am
Sorry, let me start over.
MyCommandLineComponent.js uses the nsICommandLineHandler and the helpInfo property.
Apparently, I haven't set up the command line component in myExtension correctly (or there is a bug).
If I copy myCommandLineComponent.js to /usr/lib/firefox/components/jsconsole-clhandler.js the -help option shows the helpInfo property as expected/desired.
However, if it is installed as part of a myExtension.xpi then -help does not show the helpInfo property.
Does that make more sense?
I am beginning to think this a bug.
Other applications (chatzilla) that should have valid help messages seem to have the same problem.
MyCommandLineComponent.js uses the nsICommandLineHandler and the helpInfo property.
Apparently, I haven't set up the command line component in myExtension correctly (or there is a bug).
If I copy myCommandLineComponent.js to /usr/lib/firefox/components/jsconsole-clhandler.js the -help option shows the helpInfo property as expected/desired.
However, if it is installed as part of a myExtension.xpi then -help does not show the helpInfo property.
Does that make more sense?
I am beginning to think this a bug.
Other applications (chatzilla) that should have valid help messages seem to have the same problem.
-
- Posts: 4019
- Joined: November 16th, 2003, 3:05 am
- Location: Russia, Moscow
me wrote:Right, the -help option only works with command line handlers in appdir/components. I checked it with the developer of that system, and he confirmed it's by design:
[18.01.2006 1:00] <asqueella> bsmedberg: is it by design that helpInfo from command line handlers installed in the profile doesn't show up in "firefox -help" output?
[18.01.2006 1:00] <bsmedberg> asqueella: pretty much, yes
[18.01.2006 1:06] <asqueella> bsmedberg: hmm, so what do I suggest to a person writing an extension that needs that? There doesn't seem to be any more or less elegant solution, right?
[18.01.2006 1:06] <bsmedberg> asqueella: who cares about -help output?
[18.01.2006 1:07] <bsmedberg> asqueella: document it on a website somewhere
[18.01.2006 1:07] <bsmedberg> WONTFIX
[18.01.2006 1:08] <mconnor> bsmedberg: r=me on removing all support for --help
[18.01.2006 1:08] <asqueella> heh
[18.01.2006 1:08] <bsmedberg> mconnor: well, I'm not going to go quite that far...
[18.01.2006 1:08] <shaver> --help should open it up with http://$ABCD.help.mozilla.org/$PRODUCTSHORTNAME
[18.01.2006 1:08] <shaver> in safe mode
[18.01.2006 1:08] <bsmedberg> mconnor: it is theoretically possible to write command-line apps against xulrunner, except for perhaps stdin processing
-
- Posts: 18
- Joined: December 27th, 2005, 9:20 am
So I guess that means the choises are:
a) forget about the -help option
b) write the application for xulrunner
c) install as a global application
a) may be good enough most of my users are MS/XP users and don't know what the command line is anyway.
b) I was waiting until it was critically supported (bugs in firefox are more likely to be corrected quickly).
c) I guess there is no reason it couldn't be.
My personal opinion is that the -help option should work for extensions.
It should respect the -P and -safe-mode options.
i.e.
-h should ignore the help associated with ALL extensions.
-h -a should show a list of all profiles, and the extensions associated with each, and the help of each extension.
-h -p <something> should result in the inclusion of extensions in the 'something' profile.
-h -g (or -help -global) should result in the inclusion of extensions in the global profiles (current behavior).
Presently, the running of firefox without any options is the same as including the -browser option.
I have noticed that the command line interface is different in the MS/XP and Debian environment.
-h is not available on MS/XP (or at least it behaves differntly).
-safe-mode is not available on Debian.
Apparently, a consistent command line behavior is not considered important.
Thanks for clarifying this issue.
a) forget about the -help option
b) write the application for xulrunner
c) install as a global application
a) may be good enough most of my users are MS/XP users and don't know what the command line is anyway.
b) I was waiting until it was critically supported (bugs in firefox are more likely to be corrected quickly).
c) I guess there is no reason it couldn't be.
My personal opinion is that the -help option should work for extensions.
It should respect the -P and -safe-mode options.
i.e.
-h should ignore the help associated with ALL extensions.
-h -a should show a list of all profiles, and the extensions associated with each, and the help of each extension.
-h -p <something> should result in the inclusion of extensions in the 'something' profile.
-h -g (or -help -global) should result in the inclusion of extensions in the global profiles (current behavior).
Presently, the running of firefox without any options is the same as including the -browser option.
I have noticed that the command line interface is different in the MS/XP and Debian environment.
-h is not available on MS/XP (or at least it behaves differntly).
-safe-mode is not available on Debian.
Apparently, a consistent command line behavior is not considered important.
Thanks for clarifying this issue.
Last edited by phreed on January 19th, 2006, 7:04 am, edited 1 time in total.
-
- Posts: 1752
- Joined: November 7th, 2002, 9:35 pm
If you don't know about -safe-mode, then you'd want to be able to use -help to find out... So if your XPCOM component might cause things to die, I'd think it makes sense to not load them to show -help, right?
(Imagine a binary component that crashes is NSGetModule. If it attempts to load them to show -help, it crashes...)
(Imagine a binary component that crashes is NSGetModule. If it attempts to load them to show -help, it crashes...)
poot.