Skip to content

Commit

Permalink
update to Val
Browse files Browse the repository at this point in the history
  • Loading branch information
WeihanLi committed Jun 5, 2024
1 parent cc79fea commit e2ecdc5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions build/build.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) 2022-2023 Weihan Li. All rights reserved.
// Licensed under the Apache license version 2.0 http://www.apache.org/licenses/LICENSE-2.0

var target = CommandLineParser.ArgValue(args, "target", "Default");
var apiKey = CommandLineParser.ArgValue(args, "apiKey", "");
var stable = CommandLineParser.ArgValue(args, "stable").ToBoolean();
var noPush = CommandLineParser.ArgValue(args, "noPush").ToBoolean();
var target = CommandLineParser.Val("target", "Default", args);
var apiKey = CommandLineParser.Val("apiKey", "", args);
var stable = CommandLineParser.Val("stable", null, args).ToBoolean();
var noPush = CommandLineParser.Val("noPush", null, args).ToBoolean();
var branchName = EnvHelper.Val("BUILD_SOURCEBRANCHNAME", "local");

var solutionPath = "./WeihanLi.Common.sln";
Expand Down
4 changes: 2 additions & 2 deletions src/WeihanLi.Common/Helpers/CommandLineParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static IEnumerable<string> ParseLine(string line, LineParseOptions? optio
/// <param name="defaultValue">default argument value when not found</param>
/// <returns>argument value</returns>
[return: NotNullIfNotNull(nameof(defaultValue))]
[Obsolete("Please use Value instead")]
[Obsolete("Please use Val instead")]
public static string? ArgValue(string[] args, string argumentName, string? defaultValue = default)
{
return GetOptionValueInternal(args, argumentName) ?? defaultValue;
Expand All @@ -110,7 +110,7 @@ public static IEnumerable<string> ParseLine(string line, LineParseOptions? optio
/// <param name="args">arguments</param>
/// <returns>argument value</returns>
[return: NotNullIfNotNull(nameof(defaultValue))]
public static string? Value(string optionName, string? defaultValue = default, string[]? args = null)
public static string? Val(string optionName, string? defaultValue = default, string[]? args = null)
{
return GetOptionValueInternal(args ?? Environment.GetCommandLineArgs(), optionName) ?? defaultValue;
}
Expand Down

0 comments on commit e2ecdc5

Please sign in to comment.