Skip to content

Commit

Permalink
Merge pull request #1 from Agentew04/dev
Browse files Browse the repository at this point in the history
Accept CLI support branch
  • Loading branch information
Agentew04 authored Sep 6, 2022
2 parents c728c84 + e326754 commit ff4b07b
Show file tree
Hide file tree
Showing 9 changed files with 669 additions and 577 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@ jobs:
include:
- os: windows-latest
target: win-x86
- os: windows-latest
target: win-x64
- os: windows-latest
target: win-arm
- os: windows-latest
target: win-arm64
- os: ubuntu-latest
target: linux-x64
- os: ubuntu-latest
target: linux-arm
- os: ubuntu-latest
target: linux-arm64
- os: macos-latest
target: osx-x64
- os: macos-latest
Expand All @@ -27,8 +33,6 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet publish -p:PublishSingleFile=true -r ${{ matrix.target }} -c Release --self-contained true -p:PublishTrimmed=true -p:EnableCompressionInSingleFile=true
- name: Test
Expand Down
27 changes: 27 additions & 0 deletions CliUtils.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Linq;

namespace SafeFolder;

public record Flag(string FullName, string? CompactName);

public static class CliUtils {
public static bool hasFlag(string[] args, Flag flag) {
string full = "--" + flag.FullName;
string? small = flag.CompactName is not null ? "-" + flag.CompactName : null;
return args.Any(x => x == full || ( small is not null && x == small ));
}

public static string? getFlagValue(string[] args, Flag flag) {
string full = "--" + flag.FullName;
string? small = flag.CompactName is not null ? "-" + flag.CompactName : null;

for (var i = 0; i < args.Length; i++) {
if (args[i] != full && args[i] != small)
continue;
if (i + 1 < args.Length) {
return args[i + 1];
}
}
return null;
}
}
126 changes: 0 additions & 126 deletions Encryptor.cs

This file was deleted.

Loading

0 comments on commit ff4b07b

Please sign in to comment.