Branch: Tag:

2016-11-05

2016-11-05 15:24:08 by Martin Nilsson <nilsson@fastmail.com>

Added Arg.PATH and Arg.APP to get the path and file name of the application.

415:      } // -- OptLibrary    - object REST = class { -  protected string _sprintf(int t) + protected class LookupKey   { -  return "Arg.REST"; +  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();   //!   //! Constant used by Arg.parse() to indicate the remaining objects.    -  +    // FIXME: Support for rc files? ( Opt x = Opt("--x")|INIFile(path, name); )   // FIXME: Support for type casts? ( Opt level = Integer(Opt("--level"));   
530:    protected mixed `[](mixed id)    {    if( id==REST ) return argv; +  if( id==PATH ) return application; +  if( id==APP ) return basename(application);    return values[id];    }