[Mono-bugs] [Bug 79208][Wis] New - Mono.GetOptions Usage statement should show filename

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Aug 29 12:09:56 EDT 2006

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by foxxyzoe at gmail.com.


--- shadow/79208	2006-08-29 12:09:55.000000000 -0400
+++ shadow/79208.tmp.32625	2006-08-29 12:09:55.000000000 -0400
@@ -0,0 +1,53 @@
+Bug#: 79208
+Product: Mono: Class Libraries
+Version: 1.0
+OS Details: 
+Status: NEW   
+Priority: Wishlist
+Component: Mono.POSIX
+AssignedTo: miguel at ximian.com                            
+ReportedBy: foxxyzoe at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Mono.GetOptions Usage statement should show filename
+NOTE: This has nothing to do with Mono.POSIX but there was no
+Mono.GetOptions or generic component option so I just had to pick one.
+The usage statement shown with "--help" prints a line like this:
+"Usage: MyAssemblyName [options]"
+In Mono.GetOptions/OptionList.cs the code looks like this (condensed):
+entry = Assembly.GetEntryAssembly();
+appExeName = entry.GetName().Name;
+return "Usage: " + appExeName + " [options]";
+AssemblyName.Name returns the assembly name but that's not what we want. 
+As a simple example, the file extension is stripped and so it doesn't even
+print MyAssemblyName.exe.  Regardless of this, many times there is a small
+script in /usr/bin which runs the actual assembly.  In this situation, the
+name printed in the usage statement may be unrelated to the actual
+executable name as the user sees it.
+Parsing the command line via Environment.GetCommandLineArgs() will only
+return whatever was passed to /usr/bin/mono and thus won't show what the
+user actually typed should a script be used.  So perhaps we should back up
+a level into Mono.GetOptions.Options and just add an overload to
+Mono.GetOptionsOptionList constructor with a parameter to specify the
+program name.
+Additionally, perhaps a pre-defined option such as "--exe-name" could be
+added to Mono.Options, which would take the commandline name as an
+argument.  Then in the /usr/bin script, the program author could write
+"mono /usr/lib/foo/foo.exe --exe-name $0".
+Just ideas but somehow I would like the ability to get the actual program
+name so as to not confuse the user.

More information about the mono-bugs mailing list