pike.git / lib / modules / Arg.pmod

version» Context lines:

pike.git/lib/modules/Arg.pmod:1: - // Argument parser - // By Martin Nilsson - // + #pike __REAL_VERSION__      //! Argument parsing module - //! This module supports two rather different methods of argument parsing. - //! The first is suitable quick argument parsing without much in the way of checking: +    //! -  + //! This module supports two rather different methods of argument + //! parsing. The first is suitable quick argument parsing without + //! much in the way of checking: + //!   //! @code   //! int main( int c, array(string) argv )   //! {   //! mapping arguments = Arg.parse(argv);   //! array files = arguments[Arg.REST];   //! if( arguments->help ) print_help();   //! ...   //! }   //! @endcode   //!
pike.git/lib/modules/Arg.pmod:35:   //!   //! Then, in main:   //!   //! @code   //! MyArguments args = MyArguments(argv);   //! @endcode   //!   //! See the documentation for @[OptLibrary] for details about the various   //! Opt classes.    - #pike __REAL_VERSION__ -  +    //! This class contains a library of parser for different type of   //! options.   class OptLibrary   {       //! Base class for parsing an argument. Inherit this class to create    //! custom made option types.    class Opt    {    constant is_opt = 1;
pike.git/lib/modules/Arg.pmod:419:   {    protected string name;    protected void create(string name) { this::name = name; }    protected string _sprintf(int t) { return t=='O' && "Arg."+name; }   }      LookupKey REST = LookupKey("REST");   LookupKey APP = LookupKey("APP");   LookupKey PATH = LookupKey("PATH");    - //! @decl constant REST = REST(); + //! @decl constant REST;   //! - //! Constant used by Arg.parse() to indicate the remaining objects. + //! Constant used to represent command line arguments not identified + //! as options. Can be used both in the response mapping from @[parse] + //! and when indexing an @[Options] object.    -  + //! @decl constant APP; + //! + //! Constant used to represent the name of the application from the + //! command line. Can be used when indexing an @[Options] object. +  + //! @decl constant PATH; + //! + //! Constant used to represent the full paht of the applicatiojn from + //! the command line. Can be used when indexing an @[Options] object. +    // FIXME: Support for rc files? ( Opt x = Opt("--x")|INIFile(path, name); )   // FIXME: Support for type casts? ( Opt level = Integer(Opt("--level"));      class LowOptions    //!   {    protected inherit OptLibrary;       //!    protected mapping(string:Opt) opts = ([]);