Skip to content

Commit ad0dc0a

Browse files
committed
ci: pack
1 parent 6b432bb commit ad0dc0a

File tree

10 files changed

+147
-7
lines changed

10 files changed

+147
-7
lines changed

.github/ISSUE_TEMPLATE/bug.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Bug report / 错误报告
3+
about: Create a report to help us improve / 创建报告以帮助我们改进
4+
title: "[bug] "
5+
labels: bug
6+
---
7+
8+
<!--
9+
请提供下述完整信息以便快速定位问题 / Please provide the following information to quickly locate the problem
10+
-->
11+
12+
- 系统环境 / System Environment:
13+
14+
15+
- 版本号 / Version:
16+
17+
18+
- 问题描述 / Description of the issue:
19+
20+
21+
- 复现步骤 / Reproduction steps:
22+

.github/ISSUE_TEMPLATE/normal.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
name: Feel free to express / 随便写写
3+
about: Record something / 简单写写记录记录
4+
---
5+
6+
- Feel free to express yourself / 请自由发挥
7+

.github/ISSUE_TEMPLATE/question.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name: I have a question / 我有疑问
3+
about: Solve your problem / 解决你的疑问
4+
title: "[question] "
5+
labels: question
6+
---
7+
8+
- Problem Description / 问题描述
9+

.github/ISSUE_TEMPLATE/suggestion.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name: I have suggestions / 我有建议
3+
about: Your suggestions may benefit everyone / 你的建议可能让所有人受益
4+
title: "[suggestion] "
5+
labels: suggestion
6+
---
7+
8+
- Your suggestions / 你的建议
9+

.github/workflows/library.nuget.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: pack
2+
3+
on:
4+
release:
5+
types: [created]
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
build:
12+
runs-on: windows-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- name: Setup .NET
18+
uses: actions/setup-dotnet@v2
19+
with:
20+
dotnet-version: 8.0.x
21+
22+
- name: Setup Windows SDK
23+
uses: GuillaumeFalourd/[email protected]
24+
25+
- name: Install dependencies
26+
run: dotnet restore
27+
28+
- name: Build
29+
run: dotnet build --configuration Release --no-restore
30+
31+
- name: Pack
32+
run: dotnet pack src\Flucli\Flucli.csproj -c Release --no-build -o out
33+
34+
- name: Push NuGet package
35+
# run: dotnet nuget push "out\*.nupkg" -k ${{secrets.NUGET_AUTH_TOKEN}} --source https://api.nuget.org/v3/index.json
36+
uses: actions/upload-artifact@v3
37+
with:
38+
name: nuget-packages
39+
path: out/*.nupkg

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,31 @@
1+
[![NuGet](https://img.shields.io/nuget/v/Flucli.svg)](https://nuget.org/packages/Flucli) [![GitHub license](https://img.shields.io/github/license/lemutec/Flucli)](https://github.com/lemutec/Flucli/blob/master/LICENSE.txt) [![Actions](https://github.com/lemutec/Flucli/actions/workflows/library.nuget.yml/badge.svg)](https://github.com/lemutec/Flucli/actions/workflows/library.nuget.yml)
2+
13
# Flucli
4+
5+
Library for interacting with external command-line interfaces.
6+
7+
Ported from [CliWrap](https://github.com/Tyrrrz/CliWrap) and support `.netstandard 2.0` without other dependencies.
8+
9+
Support `Verb="runas"` and simplify some APIs.
10+
11+
## Usage
12+
13+
```c#
14+
StringBuilder stdout = new();
15+
StringBuilder stderr = new();
16+
17+
var command1 = "cmd"
18+
.WithArguments("/c echo Hello World!");
19+
20+
var command2 = "cmd"
21+
.WithArguments("/c findstr o")
22+
.WithStandardOutputPipe(PipeTarget.ToStringBuilder(stdout, Encoding.UTF8))
23+
.WithStandardErrorPipe(PipeTarget.ToStringBuilder(stderr, Encoding.UTF8));
24+
25+
CliResult result = await (command1 | command2).ExecuteAsync();
26+
27+
Console.WriteLine("STDOUT: " + stdout.ToString());
28+
Console.WriteLine("STDERR: " + stderr.ToString());
29+
Console.WriteLine("ExitCode is " + result.ExitCode);
30+
```
31+
File renamed without changes.
File renamed without changes.

src/Flucli.Test/Program.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,21 @@ static void Main(string[] args)
88
{
99
Task.Run(async () =>
1010
{
11-
byte[] array = new byte[100];
12-
using MemoryStream ms = new(array);
11+
StringBuilder stdout = new();
12+
StringBuilder stderr = new();
1313

1414
var command1 = "cmd"
15-
.WithArguments("/c echo Hello");
15+
.WithArguments("/c echo Hello World!");
1616

1717
var command2 = "cmd"
18-
.WithArguments("/c findstr H")
19-
.WithStandardOutputPipe(PipeTarget.ToStream(ms));
18+
.WithArguments("/c findstr o")
19+
.WithStandardOutputPipe(PipeTarget.ToStringBuilder(stdout, Encoding.UTF8))
20+
.WithStandardErrorPipe(PipeTarget.ToStringBuilder(stderr, Encoding.UTF8));
2021

2122
CliResult result = await (command1 | command2).ExecuteAsync();
22-
string output = Encoding.UTF8.GetString(array);
2323

24-
Console.WriteLine("STDOUT: " + output);
24+
Console.WriteLine("STDOUT: " + stdout.ToString());
25+
Console.WriteLine("STDERR: " + stderr.ToString());
2526
Console.WriteLine("ExitCode is " + result.ExitCode);
2627
});
2728

src/Flucli/Flucli.csproj

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,32 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4+
<PackageId>Flucli</PackageId>
5+
<Product>Flucli</Product>
46
<TargetFrameworks>.netstandard2.0;net471;net472;net48;net481;net5.0-windows;net6.0-windows;net7.0-windows;net8.0-windows;</TargetFrameworks>
57
<Nullable>enable</Nullable>
68
<LangVersion>latest</LangVersion>
9+
<AssemblyName>Flucli</AssemblyName>
10+
<EnableWindowsTargeting>true</EnableWindowsTargeting>
11+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
12+
<AssemblyVersion>0.1.0.0</AssemblyVersion>
13+
<FileVersion>0.1.0.0</FileVersion>
14+
<Version>$(VersionPrefix)0.1.0.0-beta</Version>
15+
<Authors>ema</Authors>
16+
<Company>Lemutec</Company>
17+
<Description>Library for interacting with external command-line interfaces</Description>
18+
<PackageProjectUrl>https://github.com/lemutec/Flucli</PackageProjectUrl>
19+
<RepositoryUrl>https://github.com/lemutec/Flucli</RepositoryUrl>
20+
<RepositoryType>git</RepositoryType>
21+
<PackageTags>.NET CLI PROCESS</PackageTags>
22+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
23+
<PackageReadmeFile>README.md</PackageReadmeFile>
24+
<PackageIcon>logo.png</PackageIcon>
725
</PropertyGroup>
826

27+
<ItemGroup>
28+
<None Include="..\..\README.md" Pack="true" PackagePath="" />
29+
<None Include="..\..\image\logo.png" Pack="true" PackagePath="" />
30+
</ItemGroup>
31+
932
</Project>

0 commit comments

Comments
 (0)