Skip to content

Commit

Permalink
Merge branch 'issue59-sideeff' into develop-1.9.8-beta -> issue #59.
Browse files Browse the repository at this point in the history
Conflicts:
	CommandLine.sln.DotSettings.user
	README.md
	src/SharedAssemblyInfo.cs
  • Loading branch information
gsscoder committed Feb 28, 2013
2 parents 205094c + c29a762 commit 26d549f
Show file tree
Hide file tree
Showing 31 changed files with 954 additions and 1,108 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -21,4 +21,5 @@ src/tests/test-results/*
TestResult.xml
*.nupkg
*.old
StyleCop.Cache
StyleCop.Cache
_*.cs
2 changes: 1 addition & 1 deletion CommandLine.sln.DotSettings.user

Large diffs are not rendered by default.

14 changes: 6 additions & 8 deletions README.md
@@ -1,8 +1,12 @@
Command Line Parser Library 1.9.71.2 stable for CLR.
Command Line Parser Library 1.9.8.1 beta for CLR.
===
The Command Line Parser Library offers to CLR applications a clean and concise API for manipulating command line arguments and related tasks defining switches, options and verb commands. It allows you to display an help screen with an high degree of customization and a simple way to report syntax errors to the end user. Everything that is boring and repetitive to be programmed stands up on library shoulders, letting developers concentrate on core logic.
__This library provides _hassle free_ command line parsing with a constantly updated API since 2005.__

News:
---
- First attempt to remove main side effects from Parser class (help output excluded).

Compatibility:
---
- .NET Framework 3.5+
Expand Down Expand Up @@ -104,15 +108,9 @@ Resources for newcomers:
- [Wiki](https://github.com/gsscoder/commandline/wiki)
- [GNU getopt](http://www.gnu.org/software/libc/manual/html_node/Getopt.html)

Latest Changes:
---
- Promoted to stable.
- Implicit name is now available on ``OptionAttribute`` and ``OptionListAttribute``.
- Fixing version numeration error.

Contacts:
---
Giacomo Stelluti Scala
- gsscoder AT gmail DOT com
- [Blog](http://gsscoder.blogspot.it)
- [Twitter](http://twitter.com/gsscoder)
- [Twitter](http://twitter.com/gsscoder)
8 changes: 4 additions & 4 deletions src/SharedAssemblyInfo.cs
Expand Up @@ -28,8 +28,8 @@

[assembly: AssemblyProduct("Command Line Parser Library")]
[assembly: AssemblyCopyright("Copyright (c) 2005 - 2013 Giacomo Stelluti Scala")]
[assembly: AssemblyVersion("1.9.71.2")]
[assembly: AssemblyFileVersion("1.9.71.2")]
[assembly: AssemblyVersion("1.9.8.1")]
[assembly: AssemblyFileVersion("1.9.8.1")]

[assembly: AssemblyInformationalVersion("1.9.71-stable")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyInformationalVersion("1.9.8-beta")]
[assembly: NeutralResourcesLanguage("en-US")]
43 changes: 5 additions & 38 deletions src/demo/Program.cs
@@ -1,11 +1,7 @@
#region License
//
// Command Line Library: Program.cs
//
// Author:
// Giacomo Stelluti Scala (gsscoder@gmail.com)
//
// Copyright (C) 2005 - 2013 Giacomo Stelluti Scala
// <copyright file="Program.cs" company="Giacomo Stelluti Scala">
// Copyright 2015-2013 Giacomo Stelluti Scala
// </copyright>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand All @@ -24,26 +20,15 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#endregion
//#define EXEC_TESTS
#region Using Directives
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using CommandLine;
using CommandLine.Text;
#if EXEC_TESTS
using CommandLine.Tests;
using CommandLine.Text.Tests;
#endif
#endregion

namespace CommandLine.Demo
{


sealed partial class Program
{
private static readonly HeadingInfo HeadingInfo = new HeadingInfo("sampleapp", "1.8");
Expand All @@ -54,16 +39,9 @@ sealed partial class Program
/// <param name="args">Command line arguments splitted by the system.</param>
private static void Main(string[] args)
{
#if EXEC_TESTS
RunATestForDebugging();
#endif
var options = new Options();
var parser = new CommandLine.Parser(with => with.HelpWriter = Console.Error);
var options = CommandLine.Parser.Default.ParseArguments<Options>(args, () => Environment.Exit(-2));

if (parser.ParseArgumentsStrict(args, options, () => Environment.Exit(-2)))
{
Run(options);
}
Run(options);
}

private static void Run(Options options)
Expand Down Expand Up @@ -118,16 +96,5 @@ private static void Run(Options options)
Console.WriteLine("[...]");
}
}

#if EXEC_TESTS
private static void RunATestForDebugging()
{
//var test = new {XYZ}Fixture();
//test.ExecUnitTestMethod("but set a breakpoint before!");
Console.Write("press any key");
Console.ReadKey();
Environment.Exit(1);
}
#endif
}
}
14 changes: 7 additions & 7 deletions src/libcmdline/Attributes/OptionListAttribute.cs
Expand Up @@ -34,18 +34,18 @@ namespace CommandLine
/// of <see cref="System.String"/> instances.
/// </summary>
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public sealed class OptionListAttribute : BaseOptionAttribute
{
public sealed class OptionListAttribute : BaseOptionAttribute
{
private const char DefaultSeparator = ':';

/// <summary>
/// <summary>
/// Initializes a new instance of the <see cref="CommandLine.OptionListAttribute"/> class.
/// The default long name will be inferred from target property.
/// </summary>
/// </summary>
public OptionListAttribute()
{
AutoLongName = true;

AutoLongName = true;

Separator = DefaultSeparator;
}

Expand Down Expand Up @@ -74,7 +74,7 @@ public OptionListAttribute(string longName)
/// <param name="longName">The long name of the option or null if not used.</param>
public OptionListAttribute(char shortName, string longName)
: base(shortName, longName)
{
{
Separator = DefaultSeparator;
}

Expand Down

0 comments on commit 26d549f

Please sign in to comment.