From 954410a050c1dc28fd68e369e195b6ff8c23d5d4 Mon Sep 17 00:00:00 2001 From: Weihan Li Date: Sat, 27 Jan 2024 16:43:09 +0800 Subject: [PATCH 1/8] Update Dockerfile --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index ba2f9db..c091f9c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,3 +19,5 @@ FROM base AS final COPY --from=build-env /app/artifacts/http /root/.dotnet/tools/http RUN ln -s /root/.dotnet/tools/http /root/.dotnet/tools/dotnet-http ENV PATH="/root/.dotnet/tools:${PATH}" +ENTRYPOINT ["http"] +CMD ["--help"] From e2cf62ac454f785650e3a73fdc42afa94342a61c Mon Sep 17 00:00:00 2001 From: Weihan Li Date: Sun, 28 Jan 2024 23:38:37 +0800 Subject: [PATCH 2/8] Update build.cs --- build/build.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build/build.cs b/build/build.cs index 2e1b048..0748286 100644 --- a/build/build.cs +++ b/build/build.cs @@ -12,6 +12,7 @@ var stable = ArgumentBool("stable", false); var noPush = ArgumentBool("noPush", false); var branchName = Environment.GetEnvironmentVariable("BUILD_SOURCEBRANCHNAME") ?? "local"; +stable |= branchName is "master" or "main"; var solutionPath = "./dotnet-httpie.sln"; string[] srcProjects = ["./src/HTTPie/HTTPie.csproj"]; @@ -59,7 +60,7 @@ await BuildProcess.CreateBuilder() .WithDependency("test") .WithExecution(async () => { - if (branchName == "master" || branchName == "main" || stable) + if (stable) { foreach (var project in srcProjects) { @@ -83,7 +84,7 @@ await BuildProcess.CreateBuilder() if (string.IsNullOrEmpty(apiKey)) { - // try to get apiKey from environment variable + // try to get apiKey from the environment variable apiKey = Environment.GetEnvironmentVariable("NuGet__ApiKey"); if (string.IsNullOrEmpty(apiKey)) @@ -93,7 +94,7 @@ await BuildProcess.CreateBuilder() } } - if (branchName != "master" && branchName != "main" && branchName != "preview") + if (!stable && branchName != "preview") { Console.WriteLine($"Skip push since branch name {branchName} not support push packages"); return; From 97d937f03c70117c65a24c10c1d268e15a25e531 Mon Sep 17 00:00:00 2001 From: Weihan Li Date: Mon, 25 Mar 2024 12:42:55 +0800 Subject: [PATCH 3/8] Update HttpParser.cs remove quotes --- src/HTTPie/Implement/HttpParser.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/HTTPie/Implement/HttpParser.cs b/src/HTTPie/Implement/HttpParser.cs index fb4941d..0ab1b6d 100644 --- a/src/HTTPie/Implement/HttpParser.cs +++ b/src/HTTPie/Implement/HttpParser.cs @@ -55,6 +55,14 @@ public async IAsyncEnumerable ParseFileAsync(string f } var (variableName, variableValue) = (splits[0], splits[1]); + if (variableValue[0] == '"' && variableValue[^1] == '"') + { + variableValue = variableValue.Trim('"'); + } + else if (variableValue[0] == '\'' && variableValue[^1] == '\'') + { + variableValue = variableValue.Trim('\''); + } if (fileScopedVariablesEnded) { requestVariables ??= new(); From bd321d0e2191535743f6a739f93b86e5fcfcfce8 Mon Sep 17 00:00:00 2001 From: Weihan Li Date: Mon, 25 Mar 2024 12:47:26 +0800 Subject: [PATCH 4/8] Update HttpParser.cs --- src/HTTPie/Implement/HttpParser.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/HTTPie/Implement/HttpParser.cs b/src/HTTPie/Implement/HttpParser.cs index 0ab1b6d..355f315 100644 --- a/src/HTTPie/Implement/HttpParser.cs +++ b/src/HTTPie/Implement/HttpParser.cs @@ -55,13 +55,9 @@ public async IAsyncEnumerable ParseFileAsync(string f } var (variableName, variableValue) = (splits[0], splits[1]); - if (variableValue[0] == '"' && variableValue[^1] == '"') + if (variableValue.Length > 1 && ((variableValue[0] == '"' && variableValue[^1] == '"') || (variableValue[0] == '\'' && variableValue[^1] == '\''))) { - variableValue = variableValue.Trim('"'); - } - else if (variableValue[0] == '\'' && variableValue[^1] == '\'') - { - variableValue = variableValue.Trim('\''); + variableValue = variableValue.Length > 2 ? variableValue[1..^2] : string.Empty; } if (fileScopedVariablesEnded) { From f18ac205be108511760ada7c887d5f3a88be66a4 Mon Sep 17 00:00:00 2001 From: Weihan Li Date: Mon, 25 Mar 2024 12:49:02 +0800 Subject: [PATCH 5/8] Update build.ps1 --- build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.ps1 b/build.ps1 index f78ac38..cf9c09b 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,4 +1,4 @@ -dotnet tool update -g dotnet-execute --prerelease +dotnet tool update -g dotnet-execute Write-Host 'dotnet-exec ./build/build.cs "--args=$ARGS"' -ForegroundColor GREEN From b282c333123c258f513abd9c46728186dd8a1604 Mon Sep 17 00:00:00 2001 From: Weihan Li Date: Mon, 25 Mar 2024 12:49:19 +0800 Subject: [PATCH 6/8] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index fd2874e..cf8d84a 100644 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/bin/sh -dotnet tool update -g dotnet-execute --prerelease +dotnet tool update -g dotnet-execute export PATH="$PATH:$HOME/.dotnet/tools" echo "dotnet-exec ./build/build.cs --args $@" From 2b7ec8e3ce06bb95bdc2d55f6fb51386325970fd Mon Sep 17 00:00:00 2001 From: Weihan Li Date: Mon, 25 Mar 2024 13:01:12 +0800 Subject: [PATCH 7/8] fix build --- src/HTTPie/Implement/HttpParser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/HTTPie/Implement/HttpParser.cs b/src/HTTPie/Implement/HttpParser.cs index 355f315..8654d65 100644 --- a/src/HTTPie/Implement/HttpParser.cs +++ b/src/HTTPie/Implement/HttpParser.cs @@ -55,7 +55,7 @@ public async IAsyncEnumerable ParseFileAsync(string f } var (variableName, variableValue) = (splits[0], splits[1]); - if (variableValue.Length > 1 && ((variableValue[0] == '"' && variableValue[^1] == '"') || (variableValue[0] == '\'' && variableValue[^1] == '\''))) + if (variableValue.Length >= 1 && ((variableValue[0] == '"' && variableValue[^1] == '"') || (variableValue[0] == '\'' && variableValue[^1] == '\''))) { variableValue = variableValue.Length > 2 ? variableValue[1..^2] : string.Empty; } From 16e0e1b09e1ddb3e094d15ddc99a38d3803d79a8 Mon Sep 17 00:00:00 2001 From: Weihan Li Date: Mon, 25 Mar 2024 13:01:44 +0800 Subject: [PATCH 8/8] bump package version --- build/version.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/version.props b/build/version.props index 3c473c2..fc6464e 100644 --- a/build/version.props +++ b/build/version.props @@ -2,7 +2,7 @@ 0 8 - 1 + 2 $(VersionMajor).$(VersionMinor).$(VersionPatch) $(PackageVersion)