Permalink
Commits on Apr 18, 2009
  1. Fix OutOfMemoryException caused by description text.

    	* src/NDesk.Options/NDesk.Options/Options.cs: Viktor Lundgren reported
    	  that Option.Description text of `"aaa." . "a" x 64` (that is, "aaa."
    	  followed by 64 "a"s) would cause GetLines() to go into an infinite
    	  loop and (eventually) die from an OutOfMemoryException.  Oops.
    	  Fix this, simplify the logic, and turn GetLines() into an
    	  IEnumerable<string>.
    	* src/NDesk.Options/Test/NDesk.Options/OptionSetTest.cs: Add tests for
    	  line breaking.
    jonpryor committed Apr 18, 2009
  2. Generate Microsoft XML Documentation Comments.

    Visual Studio looks for a .xml file alongside the .dll to display comments
    during code editing, so oblige it...
    jonpryor committed Apr 18, 2009
Commits on Oct 23, 2008
  1. Cleanup the error message with nullable types when invalid values are…

    … used.
    
    "Could not convert string `' to type Nullable`1..." is not nearly as helpful as
    "Could not convert string `' to type Int32...".
    
    	* src/NDesk.Options/NDesk.Options/Options.cs: Use the underlying
    	  target type in the error message.
    	* src/NDesk.Options/Test/NDesk.Options/OptionSetTest.cs: Add a test
    	  for the underlying target type within the exception message.
    jonpryor committed Oct 23, 2008
  2. Add support for nullable types to OptionSet.Add().

    This allows straightforward use of nullable types, e.g.
    
    		int verbosity = 0;
    		new OptionSet () {
    			{ "v:", (int? v) => verbosity = v.HasValue
    				? v.Value : verbosity + 1 },
    		}.Parse (new[]{"-v"); // verbosity == 1
    
    	* Makefile.am: Specify NDESK_OPTIONS on the compile lines.
    	* doc/en/NDesk.Options/OptionSet.xml: Document nullable type support.
    	* lib/pkgconfig/ndesk-options.pc.in: Add -d:NDESK_OPTIONS so that
    	  packages using prior versions of NDesk.Options don't see a
    	  gratuitous namespace change.
    	* src/NDesk.Options/NDesk.Options/Options.cs: Option.Parse<T>() now
    	  special-cases nullable type conversion.
    	* src/NDesk.Options/NDesk.Options/Options.cs,
    	  src/NDesk.Options/Test/NDesk.Options/OptionContextTest.cs,
    	  src/NDesk.Options/Test/NDesk.Options/OptionSetTest.cs,
    	  src/NDesk.Options/Test/NDesk.Options/OptionTest.cs,
    	  src/NDesk.Options/Test/NDesk.Options/Utils.cs: Namespace
    	  "harmonization" with Mono.Options, so that we can use identical
    	  source in each place, thus minimizing the maintenance burden.
    jonpryor committed Oct 23, 2008
Commits on Oct 13, 2008
  1. Fixup target invocations.

    	* Makefile.am: Call doc-html, not html, due to the prior
    	  doc/Makefile.include target renaming...
    jonpryor committed Oct 13, 2008
  2. Remove AC_CANONICAL_SYSTEM.

    	* configure.ac: Remove AC_CANONICAL_SYSTEM, as we're generating
    	  platform-independent IL, and thus don't need to care about the build
    	  system/platform/OS/etc.
    jonpryor committed Oct 13, 2008
  3. $(DOC_EXAMPLES_OUTPUT) should be in $(DOC_CLEANFILES).

    	* doc/Makefile.include: Remove $(DOC_EXAMPLES_OUTPUT) from
    	  $(DOC_CLEANFILES), as these files are stored in git and thus
    	  shouldn't be removed as part of the build process.  (The sample
    	  output is in git as a secondary set of "unit tests", ensuring that
    	  no unexpected changes occur.)
    jonpryor committed Oct 13, 2008
  4. Prefix documentation targets with `doc-`.

    	doc/Makefile.include: Prefix documentation targets with `doc-`.
    jonpryor committed Oct 13, 2008
Commits on Sep 16, 2008
  1. Fix .NET Compatibility.

    Apparently .NET's KeyedCollection<TKey,TValue>.Dictionary is originally null,
    and isn't allocated until .SetItem() or .InsertItem() is invoked...meaning we
    need to ensure that one of these methods is invoked before we use Dictionary.
    
    	* src/NDesk.Options/NDesk.Options/Options.cs: Ensure that InsertItem()
    	  or SetItem() are called before accessing the Dictionary property.
    	  GetKeyForItem() needs a null check (to fix an OptionSetTest for
    	  `v.Add(null)`, which would otherwise NRE).
    jonpryor committed Sep 16, 2008
  2. Correct "exception-safe" insertion.

    	* src/NDesk.Options/NDesk.Options/Options.cs: Properly keep track of
    	  the names that were added to the Dictionary, so that if an insertion
    	  fails we can properly "roll back" to the previous state.
    jonpryor committed Sep 16, 2008
Commits on Aug 16, 2008
  1. Remove several Gendarme warnings within NDesk.Options.dll

    	* src/NDesk.Options/NDesk.Options/Options.cs: Remove warnings about
    	  non-static but can be static methods, OptionException missing a
    	  default constructor, a missing LinkDemand in
    	  OptionException.GetObjectData(), internal classes which can be
    	  sealed, string optimizations, etc.
    jonpryor committed Aug 16, 2008
Commits on Jun 2, 2008
  1. Fix a build break for alp.

    	* Makefile.am: Apparently $(builddir) can be unset, which breaks the
    	  build as /src/NDesk.Options/AssemblyInfo.cs can't be found.
    jonpryor committed Jun 2, 2008
Commits on May 27, 2008
  1. Fix `make html` target.

    	* doc/.gitignore: Ignore the generated doc/ndesk-options directory.
    	* doc/Makefile.include: Fix the `html` target (broken by the previous
    	  "fix `make clean; make distcheck`" commit).
    jonpryor committed May 27, 2008
Commits on May 26, 2008
  1. Fix `make distcheck`.

    	* configure.ac: Don't generate `doc/Makefile` anymore.
    	* Makefile.am: `SUBDIRS=doc` caused `make clean; make distcheck` to fail, as
    	  `doc' would be built before `.' which fails as doc requires
    	  NDesk.Options.dll, built by `.'.  The documented solution of
    	  `SUBDIRS=. doc` didn't work, so just remove the recursive make nonsense
    	  and place everything relevant into the top-level Makefile.
    	* doc/Makefile.am: Rename to doc/Makefile.include.
    	* doc/Makefile.include: Rename symbols for namespace scoping, as this file
    	  will be `include`d from top-level Makefile.am.
    	* doc/en/examples/bundling.in, doc/en/examples/context.in,
    	  doc/en/examples/greet.in, doc/en/examples/localization.in,
    	  doc/en/examples/subclass.in: Change the program path, as they'll be
    	  executed from topdir, not from topdir/doc.
    jonpryor committed May 26, 2008
Commits on May 16, 2008
  1. Flush the documentation.

    	* doc/en/index.xml: Minor monodoc-2.0 format change.
    	* doc/en/NDesk.Options/Option.xml,
    	  doc/en/NDesk.Options/OptionAction`2.xml,
    	  doc/en/NDesk.Options/OptionSet.xml: monodoc-2.0 format
    	  changes (addition of <TypeParameters/> and changes to
    	  <TypeParameter/>); improve the docs.
    jonpryor committed May 16, 2008
Commits on Apr 7, 2008
  1. Cleanup documentation; better C# 2.0 support.

    	* src/NDesk.Options/NDesk.Options/Options.cs: Update comments to reflect
    	  current implementation (w/o repeating all the actual docs); fix some
    	  C# 3-isms that were left in the code (not sure why -langversion:ISO-2
    	  didn't catch these).
    jonpryor committed Apr 7, 2008
Commits on Mar 31, 2008
  1. Migrate the unit tests to use NUnit; place into separte files.

    	* Makefile.am: Don't build bin/options-test*.exe, instead build
    	  lib/ndesk-options/NDesk.Options_test(_linq?).dll, which contains NUnit
    	  tests for NDesk.Options.dll.  Change the `check' target to use
    	  nunit-console2 to run the unit tests.
    	* src/NDesk.Options/NDesk.Options/Options.cs: Move unit tests under
    	  src/NDesk.Options/Test/NDesk.Options/*.cs.
    	* src/NDesk.Options/Test/NDesk.Options/OptionContextTest.cs,
    	  src/NDesk.Options/Test/NDesk.Options/OptionSetTest.cs,
    	  src/NDesk.Options/Test/NDesk.Options/OptionTest.cs,
    	  src/NDesk.Options/Test/NDesk.Options/Utils.cs: Added; unit tests for
    	  NDesk.Options (originally from Options.cs).
    jonpryor committed Mar 31, 2008
Commits on Mar 30, 2008
  1. Force C# 2.0 support within NDesk.Options.dll.

    	* Makefile.am: Ensure that NDesk.Options.dll can be built under a C# 2.0
    	  compiler by specifying -langversion:ISO-2.
    jonpryor committed Mar 30, 2008
Commits on Mar 11, 2008
  1. Use KeyedCollection<string, Option> as the OptionSet base class.

    	* configure.ac: Bump the package version to 0.2.1.
    	* doc/en/NDesk.Options/Option.xml, doc/en/NDesk.Options/OptionAction`2.xml,
    	  doc/en/NDesk.Options/OptionContext.xml,
    	  doc/en/NDesk.Options/OptionException.xml,
    	  doc/en/NDesk.Options/OptionValueCollection.xml,
    	  doc/en/NDesk.Options/OptionValueType.xml: Flush new <AssemblyVersion/>.
    	* doc/en/NDesk.Options/OptionSet.xml: Flush; add new members; remove old
    	  members; flush <AssemblyVersion/>s; etc.
    	* doc/en/index.xml: Version bump.
    	* doc/en/examples/subclass.cs: Use non-obsolete methods.
    	* src/NDesk.Options/NDesk.Options/Options.cs: Use
    	  KeyedCollection<string,Option> instead of Collection<Option> as the
    	  OptionSet base class, as KeyedCollection is closer semantically to what
    	  OptionSet does.  Remove unnecessary overloads, members.  Obsolete
    	  public/protected members that we shouldn't remove yet.
    jonpryor committed Mar 11, 2008
Commits on Mar 8, 2008
  1. Document the default handler, WriteOptionDescriptions() changes.

    	* doc/en/NDesk.Options/Option.xml, doc/en/NDesk.Options/OptionSet.xml:
    	  Flush updated docs.
    	* doc/en/examples/bundling.cs: Add an example of a default handler.
    	* doc/en/examples/bundling.in: Test the default handler.
    	* doc/en/examples/bundling.txt: Flush.
    	* doc/en/examples/greet.cs: Update to make use of WriteOptionDescriptions()
    	  value formatting feature.
    	* doc/en/examples/greet.txt: Flush.
    jonpryor committed Mar 8, 2008
Commits on Mar 3, 2008
  1. Fix Option prototype checking.

    	* src/NDesk.Options/NDesk.Options/Options.cs: The previous checks for '<>'
    	  handlers was wrong, as it flagged "a|b=" (requiring 2 values) as a '<>'
    	  handler, generating an exception (which is wrong).
    jonpryor committed Mar 3, 2008
Commits on Feb 27, 2008
  1. Permit C# 2.0 compatibility.

    	* Makefile.am: Add CSFLAGS, so that we can test C# 2.0 compatibility in the
    	  future with `make CSFLAGS=-langversion:ISO-2`.
    	* src/NDesk.Options/NDesk.Options/Options.cs: Allow non-TEST code to be
    	  compiled with a C# 2.0 compile (no lambdas, no var, no auto-properties...).
    jonpryor committed Feb 27, 2008
Commits on Feb 26, 2008
  1. Add "default" argument handling support.

    	* src/NDesk.Options/NDesk.Options/Options.cs: Add "default" argument
    	  handling support.  Normally, all unhandled arguments are returned from
    	  OptionSet.Parse().  However, if an Option with the name "<>" is
    	  registered, then that Option will be invoked to handle unhandled arguments
    	  (and thus OptionSet.Parse() will always return an empty list).
    	  This is useful to handle "argument runs", where some arguments are
    	  influenced by a preceeding Option, e.g.
    	  `mdoc assemble --format=ecma dirA dirB --format=error dirC dirD`
    jonpryor committed Feb 26, 2008
Commits on Feb 24, 2008
  1. Improve HTML-generated docs.

    	* doc/.gitignore: Ignore doc-def-template.xsl.
    	* doc/doc-template.html: Rename to doc-template.xsl.
    	* doc-template.xsl: Simplification; use named templates from
    	* doc-def-template.xsl so that less code needs to be duplicated.  Add a
    	  <script/> block for prettyprint.js.
    	* doc/Makefile.am: Use `mdoc export-html` (depends on svn-version of
    	  monodoc), and extract the default template into doc-def-template.xsl.
    	  This allows us to re-use the named templates within this file, simplifying
    	  doc-template.xsl.
    	* doc/prettyprint.js: Added; JavaScript file that provides syntax color
    	  highlighting for <pre/> blocks; from Monologue.
    jonpryor committed Feb 24, 2008
Commits on Feb 21, 2008
  1. The pkgconfig file should provide a Libs: section.

    	* lib/pkgconfig/ndesk-options.pc.in: Properly follow
    	  http://www.mono-project.com/Guidelines:Application_Deployment#Libraries_with_Unstable_APIs
    	  and provide a Libs: section so `pkg-config --libs` has useful output.
    jonpryor committed Feb 21, 2008
Commits on Feb 20, 2008
  1. Add Option.Description auto-wrapping to OptionSet.WriteOptionDescript…

    …ions().
    
    	* src/NDesk.Options/NDesk.Options/Options.cs: Auto-wrap the descriptive text
    	  so that it looks nice on an 80-column wide display (i.e. descriptions
    	  shouldn't enter column 1).
    jonpryor committed Feb 20, 2008
Commits on Feb 19, 2008
  1. Add name substitution support to OptionSet.WriteOptionDescriptions().

    	* src/NDesk.Options/NDesk.Options/Options.cs: Add name substitution support.
    	  This allows the description string to contain alternate value strings to
    	  use within the option description; for example, by default the key/value
    	  Option "D=" would generate "-D=VALUE1:VALUE2 docs..."; if we provide a
    	  description of "foo {0:key}/{1:value}", then we would instead generate
    	  "-D=key:value".  If the Option takes only 1 argument, you can drop the
    	  numeric prefix and just use "{name}".
    jonpryor committed Feb 19, 2008
Commits on Feb 14, 2008
  1. Use a version-less directory for the docs.zip file.

    	* doc/Makefile.am: Use a version-less directory for the docs.zip file.
    	  This simplifies deployment to ndesk.org.
    jonpryor committed Feb 14, 2008
  2. Fix `make distcheck`.

    	* configure.ac: Don't generate lib/pkgconfig/ndesk-options-linq.pc.
    jonpryor committed Feb 14, 2008
  3. Ignore generated .mdb files.

    	* doc/en/examples/.gitignore: Ignore *.mdb files.
    jonpryor committed Feb 14, 2008
  4. Add documentation for new types.

    	* doc/en/NDesk.Options/OptionAction`2.xml,
    	  doc/en/NDesk.Options/OptionValueCollection.xml: Added.
    jonpryor committed Feb 14, 2008
  5. Remove .NET 3.5 pseudo-requirement/support.

    The .NET 3.5 support really complicated the version numbering scheme; it's
    easier to just remove the use of System.Action`2 and use a custom delegate
    type instead.  (Using the major version number for framework version means
    that the NDesk.Options major number is the assembly minor number, and by
    convention if only the assembly minor number changes the changes are intended
    to be backward compatible, which I do NOT want to gaurantee if the
    NDesk.Options major number changes, etc.  Plus, lupus called it stupid.)
    
    	* Makefile.am: Only create lib/ndesk-options/NDesk.Options.dll.
    	* README: Remove information about LINQ build & .NET 3.5 info.
    	* doc/Makefile.am: Use the right NDesk.Options.dll; Add
    	  NDesk.Options.OptionAction`2.xml; Remove System.* types.
    	* doc/en/examples/subclass.cs: Option.ValueCount -> Option.MaxValueCount.
    	* doc/en/NDesk.Options/Option.xml, doc/en/NDesk.Options/OptionContext.xml,
    	  doc/en/NDesk.Options/OptionException.xml,
    	  doc/en/NDesk.Options/OptionSet.xml,
    	  doc/en/NDesk.Options/OptionValueType.xml, doc/en/index.xml: Flush;
    	  fix version numbers, fix <see cref="..." /> links, etc.
    	* doc/en/System/Action`2.xml, doc/en/ns-System.xml: Remove.
    	* lib/pkgconfig/.gitignore: Remove no-longer-generated files.
    	* lib/pkgconfig/ndesk-options.pc.in: Update.
    	* lib/pkgconfig/ndesk-options-linq.pc.in: Remove.
    	* src/NDesk.Options/AssemblyInfo.cs.in: Simplify the assembly version number
    	  to "@VERSION@.0".  It will now always be tied to the package version.
    	* src/NDesk.Options/NDesk.Options/Options.cs: Remove System.Action`2 when
    	  LINQ isn't defined; add NDesk.Options.OptionAction`2 as replacement;
    	  rename Option.ValueCount to Option.MaxValueCount.
    jonpryor committed Feb 14, 2008
  6. Typo fix

    Alp Toker committed Feb 14, 2008
Commits on Feb 13, 2008
  1. Documentation flush.

    	* doc/Makefile.am: Add OptionValueCollection.xml.
    	* doc/doc-template.html: CSS changes for HTML documentation.
    	* doc/en/NDesk.Options/Option.xml, doc/en/NDesk.Options/OptionContext.xml,
    	  doc/en/NDesk.Options/OptionException.xml,
    	  doc/en/NDesk.Options/OptionSet.xml,
    	  doc/en/NDesk.Options/OptionValueType.xml, doc/en/System/Action`2.xml,
    	  doc/en/index.xml: Flush documentation updates.
    	* doc/en/examples/.gitignore: Ignore generated files.
    	* doc/en/examples/bundling.cs, doc/en/examples/bundling.in,
    	  doc/en/examples/bundling.txt: Add new example program.
    jonpryor committed Feb 13, 2008