Skip to content

Commit 96a6af4

Browse files
committed
v1.0.3 is out
1 parent 751ace1 commit 96a6af4

File tree

10 files changed

+246
-144
lines changed

10 files changed

+246
-144
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Build & Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
os: [windows-latest, ubuntu-latest, macos-latest]
14+
arch: [x64, x86]
15+
exclude:
16+
- os: macos-latest
17+
arch: x86
18+
19+
steps:
20+
# Checkout the repo
21+
- uses: actions/checkout@v4
22+
23+
- name: Setup .NET
24+
uses: actions/setup-dotnet@v4
25+
with:
26+
dotnet-version: '8.0.x'
27+
28+
- name: Build solution
29+
run: dotnet build RedSeaMarkupLanguage.sln -c Release -p:Platform=${{ matrix.arch }}
30+
31+
# to uncomment if I add unit testing
32+
#- name: Run tests
33+
# run: dotnet test ./RSML.Tests/RSML.Tests.csproj --no-build
34+
35+
- name: Pack & push to NuGet
36+
if: github.event_name == 'push' && matrix.os == 'windows-latest' && matrix.arch == 'x64'
37+
run: |
38+
dotnet pack ./RSML/RSML.csproj -c Release -o ./nupkg
39+
dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
40+
41+
- name: Publish CLI archives
42+
if: matrix.arch == 'x64'
43+
run: |
44+
dotnet publish ./RSML.CLI/RSML.CLI.csproj -c Release -r ${{ matrix.os == 'windows-latest' && 'win-x64' || matrix.os == 'ubuntu-latest' && 'linux-x64' || 'osx-x64' }} --self-contained true -o publish
45+
46+
cd publish
47+
zip -r ../RSML.CLI-${{ matrix.os }}.zip .
48+
tar -czf ../RSML.CLI-${{ matrix.os }}.tar.gz .
49+
cd ..
50+
51+
- uses: actions/checkout@v4
52+
53+
release:
54+
name: Create GitHub Release
55+
needs: [build]
56+
runs-on: ubuntu-latest
57+
58+
steps:
59+
- uses: actions/checkout@v4
60+
61+
- name: Download CLI archives
62+
uses: actions/download-artifact@v4
63+
with:
64+
path: ./release-assets
65+
66+
- name: Display downloaded files
67+
run: ls -R ./release-assets
68+
69+
- name: Upload release artifacts
70+
uses: softprops/action-gh-release@v2
71+
with:
72+
files: |
73+
./release-assets/**/**/*.zip
74+
./release-assets/**/**/*.tar.gz
75+
./release-assets/**/**/*.nupkg
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
79+
- uses: actions/checkout@v4

.github/workflows/dotnet_release_winx64.yml

Lines changed: 0 additions & 63 deletions
This file was deleted.

Assets/v1.0.3_Demo.png

81.5 KB
Loading

RSML.CLI/Program.cs

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
using System.Threading.Tasks;
33
using System.Linq;
44
using System.Reflection;
5+
using System.Runtime.InteropServices;
56

67
using System.CommandLine;
78

8-
using RSML;
99
using RSML.Parser;
10-
using System.Runtime.InteropServices;
1110
using RSML.Exceptions;
1211

1312

@@ -108,13 +107,19 @@ static async Task Main(string[] args)
108107
description: "Custom RID to check against",
109108
getDefaultValue: () => null
110109
);
110+
var expandAnyOption = new Option<bool>(
111+
aliases: ["--expand-any", "-x"],
112+
description: "Expands the any RID",
113+
getDefaultValue: () => false
114+
);
111115

112116
evaluateCommand.AddOption(printOnlyPrimaryOption);
113117
evaluateCommand.AddOption(customRidOption);
118+
evaluateCommand.AddOption(expandAnyOption);
114119
evaluateCommand.AddOption(fallbackForErrorOption);
115120
evaluateCommand.AddOption(fallbackForNullOption);
116121

117-
evaluateCommand.SetHandler(void (primaryOnly, nullFallback, errorFallback, customRid) =>
122+
evaluateCommand.SetHandler(void (primaryOnly, nullFallback, errorFallback, customRid, expandAny) =>
118123
{
119124

120125
string? currentInState = Console.In.ReadToEnd();
@@ -149,9 +154,26 @@ static async Task Main(string[] args)
149154
try
150155
{
151156

152-
Console.WriteLine(customRid is null
153-
? document.EvaluateDocument() ?? ((nullFallback ?? "") == "" ? "[WARNING] No match was found." : nullFallback!)
154-
: document.EvaluateDocument(customRid, null) ?? ((nullFallback ?? "") == "" ? "[WARNING] No match was found." : nullFallback!));
157+
if (customRid is not null)
158+
{
159+
160+
Console.WriteLine(
161+
(document.EvaluateDocument(customRid, expandAny)) ??
162+
((nullFallback is null)
163+
? "[WARNING] No match was found."
164+
: nullFallback));
165+
166+
}
167+
else
168+
{
169+
170+
Console.WriteLine(
171+
(document.EvaluateDocument(expandAny)) ??
172+
((nullFallback is null)
173+
? "[WARNING] No match was found."
174+
: nullFallback));
175+
176+
}
155177

156178
}
157179
catch (RSMLRuntimeException ex)
@@ -164,7 +186,7 @@ static async Task Main(string[] args)
164186

165187
Environment.Exit(0);
166188

167-
}, printOnlyPrimaryOption, fallbackForNullOption, fallbackForErrorOption, customRidOption);
189+
}, printOnlyPrimaryOption, fallbackForNullOption, fallbackForErrorOption, customRidOption, expandAnyOption);
168190

169191
evaluateCommand.AddAlias("eval");
170192
evaluateCommand.AddAlias("parse");
@@ -175,7 +197,7 @@ static async Task Main(string[] args)
175197
repoCommand.SetHandler(void () =>
176198
{
177199

178-
Console.WriteLine("\033[1mVisit the repository at:\033[0m\033[4mhttps://github.com/OceanApocalypseStudios/RedSeaMarkupLanguage\033[0m");
200+
Console.WriteLine("Visit the repository at: https://github.com/OceanApocalypseStudios/RedSeaMarkupLanguage");
179201
Environment.Exit(0);
180202

181203
});

RSML.CLI/RSML.CLI.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@
1919
<DebugType>none</DebugType>
2020
</PropertyGroup>
2121

22-
<ItemGroup>
23-
<None Include="..\runner.ps1">
24-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
25-
</None>
26-
</ItemGroup>
27-
2822
<ItemGroup>
2923
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
3024
</ItemGroup>

RSML.Docs/Program.vb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
Imports System
2-
Imports System.Formats
31
Imports System.IO
42

53

@@ -21,6 +19,7 @@ Module Program
2119

2220
Dim format As OutputFormat
2321

22+
Console.WriteLine("[DEPRECATION] Soon, RSML.Docs will be deprecated in favor of Org4Docs. This will NOT affect the actual documentation.")
2423
Console.WriteLine("[WARNING] This program requires Emacs (recommended version: 30.1). Make sure it's on PATH.")
2524
Console.WriteLine("[->] Press any key to continue or 'q' to abort...")
2625
Console.Beep()

RSML/DocumentSaveLoad.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.IO;
2+
using System.Threading.Tasks;
23

34

45
namespace RSML
@@ -21,6 +22,13 @@ public sealed partial class RSDocument
2122
/// <returns>The RSML inside the file</returns>
2223
public static string LoadRSMLFromFile(string filepath) => File.ReadAllText(filepath);
2324

25+
/// <summary>
26+
/// Loads a RSML file into a string asynchronously.
27+
/// </summary>
28+
/// <param name="filepath">The path to the file</param>
29+
/// <returns>The RSML inside the file</returns>
30+
public static async Task<string> LoadRSMLFromFileAsync(string filepath) => await File.ReadAllTextAsync(filepath);
31+
2432
/// <summary>
2533
/// Loads a RSML file into a document.
2634
/// </summary>

0 commit comments

Comments
 (0)