Hi Chris,
Honestly i can't respond to your question, i don't know !
This is a complete sample for what your are trying to do:
[indent=4]
version : bool
const my_options : array of OptionEntry = {{"version", 'V', 0,
OptionArg.NONE, ref version, "Show application's version", null}, {null}}
class Options : Object
def run (args : array of string)
optioncontext : OptionContext
optioncontext = new OptionContext ("- My program in Genie")
optioncontext.add_main_entries (my_options, null)
try
optioncontext.parse(ref args)
except e : OptionError
print (("%s\nRun '%s --help' to see a full list of
available command line options."), e.message, args[0])
if version is true
print "My program version 1.0"
init
var options = new Options()
options.run(args)
You can try like this:
./myprog -V (to see version)
./myprog --help (to see available options)
./myprog -B (to see what happen if user use unrecognised options)
Cheers,
Nicolas.
Ok that works, thanks for the help. Could you explain why I can't
define an array of OptionEntry objects in the scope of init?
Cheers,
Chris
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list