|
From: TheFGFSEagle <the...@gm...> - 2023-09-01 18:05:24
|
Well, you could by using a proper argument parser like https://github.com/p-ranav/argparse - very similar API as the python argparse modules. Am Fr., 1. Sept. 2023 um 19:29 Uhr schrieb James Turner < ja...@fl...>: > > > On 31 Aug 2023, at 11:39, PlayeRom Roman Ludwicki < > rom...@pl...> wrote: > > Yes, the mechanism will be universal for each option. Anything typed after > an option that does not start with "-" will be treated as a parameter/value > for the current preceding option. If it is a configuration file for the > --config, it will be passed to the config option. > If an option is written with "=", it is handled as it is now. > > There is also a mechanism for passing XML files directly: > `fgfs --option1 --option2 -- property-list1.xml property-list2.xml`. > So after options, we can type "--" (the end of options tag) and then pass > only XML files. > We can also pass XML files without options: > `fgfs property-list1.xml property-list2.xml` > or pass the options after the XML files: > `fgfs property-list1.xml property-list2.xml --option1 --option2` > > This will also be kept unchanged. > > > Sure, but right now I think you can (in the worst case) pass xml files in > the middle of options, and I wonder how you would distinguish that case in > the future : we do *not* (as far as I know) rely on the ’—‘ to end options > parsing and switch to ‘list of config/xml files’ mode, rather we just > assume that any arg which does not start with ‘—‘ is a config file. > > My concern is with the new syntax, because some options have *optional* > values, you have an ambiguity in the parse. It’s probably not a big deal, > since it would show up as a likely incorrect ‘option value’ (eg the parser > sees foo-config.xml where it was expecting a value like true/yes/false/0), > but I still don’t think you can eliminate this ambiguity completely. > > Kind regards, > James > > _______________________________________________ > Flightgear-devel mailing list > Fli...@li... > https://lists.sourceforge.net/lists/listinfo/flightgear-devel > |