Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
moh-hassan committed May 4, 2020
2 parents e80b4dc + 24e2be2 commit 4c2a115
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 51 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ All notable changes to this project will be documented in this file.

CommandLineParser project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.8.0-preview1] - 2020-3-12
## [2.8.0] - 2020-5-1
## [2.8.0-preview4] - 2020-4-30
## [2.8.0-preview1] - 2020-3-14

### Added
- Added support for async programming for `WithParsed and WithNotParsed` by [@joseangelmt, PR# 390 ](https://github.com/commandlineparser/commandline/pull/390).
- Publish a new symbol packages with source link support for c# and F# (.snupkg) to improved package debugging experience by [@moh-hassan, PR#554](https://github.com/commandlineparser/commandline/pull/554)
- Add default verb support by [@Artentus, PR# 556](https://github.com/commandlineparser/commandline/pull/556).
- Add more details for localized attribute properties by [@EdmondShtogu, PR# 558](https://github.com/commandlineparser/commandline/pull/558)
- Support Default in Group Options and raise error if both SetName and Group are applied on option by [@hadzhiyski, PR# 575](https://github.com/commandlineparser/commandline/pull/575).
- Support mutable types without empty constructor that only does explicit implementation of interfaces by [@pergardebrink](https://github.com/commandlineparser/commandline/pull/590).
- Support mutable types without empty constructor that only does explicit implementation of interfaces by [@pergardebrink, PR#590](https://github.com/commandlineparser/commandline/pull/590).


### Changed
- Tests cleanup by [@gsscoder, PR# 560](https://github.com/commandlineparser/commandline/pull/560).
Expand All @@ -19,6 +23,7 @@ CommandLineParser project adheres to [Semantic Versioning](https://semver.org/sp
- SkipDefault is being respected by [Usage] Examples by [@kendfrey, PR# 565](https://github.com/commandlineparser/commandline/pull/565).
- Remove useless testing code by [@gsscoder, PR# 568](https://github.com/commandlineparser/commandline/pull/568).
- Remove constraint on T for ParseArguments with factory (required by issue #70) by [@pergardebrink](https://github.com/commandlineparser/commandline/pull/590).
- Update nuget api key by [@ericnewton76](https://github.com/commandlineparser/commandline/commit/2218294550e94bcbc2b76783970541385eaf9c07)

### Fixed
- Fix #579 Unable to parse TimeSpan given from the FormatCommandLine by [@gsscoder, PR# 580](https://github.com/commandlineparser/commandline/pull/580).
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ The Command Line Parser Library offers CLR applications a clean and concise API
C:\Project> NuGet Install CommandLineParser
```

# Nightly Build

Nightly version of the CommandLineParser can be downloaded from github [Releases](https://github.com/commandlineparser/commandline/releases).

The Last new features and fixes, read [changelog](https://github.com/commandlineparser/commandline/blob/master/CHANGELOG.md)


_NOTE: Mentioned F# Support is provided via ```CommandLineParser.FSharp``` package with FSharp dependencies._

__This library provides _hassle free_ command line parsing with a constantly updated API since 2005.__
Expand Down
71 changes: 24 additions & 47 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#version should be only changed with RELEASE eminent, see RELEASE.md

version: 2.8.0-ci-{build}
image:
- Visual Studio 2019
- ubuntu1804

image: Visual Studio 2019

clone_depth: 1
pull_requests:
do_not_increment_build_number: false
do_not_increment_build_number: true

init:
- ps: |
Expand All @@ -16,69 +15,47 @@ init:
if ($env:APPVEYOR_REPO_TAG -eq "true") {
$ver = $env:APPVEYOR_REPO_TAG_NAME
if($ver.StartsWith("v") -eq $true) { $ver = $ver.Substring(1) }
$env:PACKAGE_VERSION = $ver
} else {
$env:PACKAGE_VERSION = $env:APPVEYOR_BUILD_VERSION
Update-AppveyorBuild -Version $ver
}
- ps: |
Write-Host "PACKAGE_VERSION:$env:PACKAGE_VERSION | APPVEYOR_BUILD_VERSION='$env:APPVEYOR_BUILD_VERSION'" -ForegroundColor Yellow
Write-Host "APPVEYOR_REPO_TAG_NAME:$env:APPVEYOR_REPO_TAG_NAME'" -ForegroundColor Yellow
skip_commits:
files:
- docs/*
- art/*
- '**/*.md'
- .gitignore
- .editorconfig
message: /updated readme.*|update readme.*s|update docs.*|update version.*|update changelog.*/
environment:
matrix:
- BUILD_TARGET: base
- BUILD_TARGET: fsharp

build_script:
- cmd: dotnet build src/CommandLine/ -c Release --version-suffix %PACKAGE_VERSION% /p:BuildTarget=%BUILD_TARGET%
- sh: dotnet build src/CommandLine/ -c Release --version-suffix $PACKAGE_VERSION /p:BuildTarget=$BUILD_TARGET
- cmd: dotnet build src/CommandLine/ -c Release --version-suffix %APPVEYOR_BUILD_VERSION% /p:BuildTarget=%BUILD_TARGET%

test_script:
- cmd: dotnet test tests/CommandLine.Tests/ /p:BuildTarget=%BUILD_TARGET%
- sh: dotnet test tests/CommandLine.Tests/ /p:BuildTarget=$BUILD_TARGET -f netcoreapp2.0

after_test:
- cmd: dotnet pack src/CommandLine/ -c Release --version-suffix %PACKAGE_VERSION% /p:BuildTarget=%BUILD_TARGET%
- sh: dotnet pack src/CommandLine/ -c Release --version-suffix $PACKAGE_VERSION /p:BuildTarget=$BUILD_TARGET
- cmd: dotnet pack src/CommandLine/ -c Release --version-suffix %APPVEYOR_BUILD_VERSION% /p:BuildTarget=%BUILD_TARGET%

artifacts:
- path: 'src/CommandLine/bin/Release/*.nupkg'
name: NuGetPackages
- path: 'src/CommandLine/bin/Release/*.snupkg'
name: symbol
name: symbol

on_failure:
- cmd: |
tree /f /a >files.lst
appveyor PushArtifact .\files.lst -DeploymentName "Failed Build File Listing"
for:
-
matrix:
only:
- image: Visual Studio 2019
deploy:
- provider: GitHub
auth_token:
secure: hVyVwHl0JiVq0VxXB4VMRWbUtrGclIzadfnWFcWCQBLvbgMLahLBnWlwGglT63pZ
artifact: 'NuGetPackages'
prerelease: false
force_update: true #fsharp package runs as separate build job, so have to force_update to add fsharp.nuget added
on:
APPVEYOR_REPO_TAG: true

- provider: NuGet
api_key:
secure: Ab4T/48EyIJhVrqkfKdUxmHUtseEVuXuyrGACxZ0KN35rb/BzABlBM2YjZojicvT
artifact: 'NuGetPackages'
on:
APPVEYOR_REPO_TAG: true

deploy:
- provider: GitHub
auth_token:
secure: hVyVwHl0JiVq0VxXB4VMRWbUtrGclIzadfnWFcWCQBLvbgMLahLBnWlwGglT63pZ
artifact: /.*(\.|\.s)nupkg/
prerelease: false
force_update: true #fsharp package runs as separate build job, so have to force_update to add fsharp.nuget added
on:
APPVEYOR_REPO_TAG: true

- provider: NuGet
api_key:
secure: e2gJJ3r6Uls5trJwryaudAZd49QniNfIjax/A+tfywlchSnIQVOzOQCO9tTSNccI
artifact: /.*(\.|\.s)nupkg/
on:
APPVEYOR_REPO_TAG: true
2 changes: 1 addition & 1 deletion src/CommandLine/UnParserExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private static string FormatValue(Specification spec, object value)

private static object FormatWithQuotesIfString(object value)
{
if (value is DateTime || value is TimeSpan || value is DateTimeOffset) return $"\"{value}\"";
if (value is DateTime || value is DateTimeOffset) return $"\"{value}\"";
Func<string, string> doubQt = v
=> v.Contains("\"") ? v.Replace("\"", "\\\"") : v;

Expand Down
16 changes: 16 additions & 0 deletions tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,22 @@ public void Parse_TimeSpan()
expectedResult.Should().BeEquivalentTo(((Parsed<Options_With_TimeSpan>)result).Value);
}

#region Issue 579
[Fact]
public void Should_not_parse_quoted_TimeSpan()
{
// Exercize system
var result = InvokeBuild<Options_With_TimeSpan>(new[] { "--duration=\"00:42:00\"" });

var outcome = result as NotParsed<Options_With_TimeSpan>;

// Verify outcome
outcome.Should().NotBeNull();
outcome.Errors.Should().NotBeNullOrEmpty()
.And.HaveCount(1)
.And.OnlyContain(e => e.GetType().Equals(typeof(BadFormatConversionError)));
}
#endregion

[Fact]
public void OptionClass_IsImmutable_HasNoCtor()
Expand Down
13 changes: 12 additions & 1 deletion tests/CommandLine.Tests/Unit/UnParserExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ public static void UnParsing_instance_with_dash_in_value_and_dashdash_disabled_r
.Should().BeEquivalentTo("-something with dash");
}

#region Issue 579
[Fact]
public static void UnParsing_instance_with_TimeSpan_returns_the_value_unquoted_in_command_line()
{
var options = new Options_With_TimeSpan { Duration = TimeSpan.FromMinutes(1) };
new Parser()
.FormatCommandLine(options)
.Should().Be("--duration 00:01:00");
}
#endregion

#region PR 550

[Fact]
Expand Down Expand Up @@ -175,7 +186,7 @@ public static void UnParsing_instance_with_timespan()
var options = new Options_TimeSpan { Start = ts };
var result = new Parser()
.FormatCommandLine(options)
.Should().BeEquivalentTo("--start \"01:02:03\"");
.Should().BeEquivalentTo("--start 01:02:03"); //changed for issue 579
}

[Theory]
Expand Down

0 comments on commit 4c2a115

Please sign in to comment.