diff --git a/README.md b/README.md index 32ade6e..afd10f0 100644 --- a/README.md +++ b/README.md @@ -76,9 +76,17 @@ regex --case-sensitive Hello notes.txt Replace with a named group (rewrites the file, files without matches stay untouched) ``` -regex "Name:(?[A-Za-z]+)" --replace "id=${name}" names.txt +regex "Name:(?[A-Za-z]+)" --replace 'id=${name}' names.txt ``` +## Example Videos + +[Recursive .txt search (GIF)](examples/videos/recursive-search.gif) · [MP4](examples/videos/recursive-search.mp4) + +[Case-sensitive search (GIF)](examples/videos/case-sensitive.gif) · [MP4](examples/videos/case-sensitive.mp4) + +[Named-group replacement (GIF)](examples/videos/named-replacement.gif) · [MP4](examples/videos/named-replacement.mp4) + ## Changelog See [CHANGELOG.md](./CHANGELOG.md). diff --git a/examples/data/names.txt b/examples/data/names.txt new file mode 100644 index 0000000..3b9a5c5 --- /dev/null +++ b/examples/data/names.txt @@ -0,0 +1,3 @@ +Name:Anna +Name:Ben +Name:Cara diff --git a/examples/data/notes.txt b/examples/data/notes.txt new file mode 100644 index 0000000..9d279bd --- /dev/null +++ b/examples/data/notes.txt @@ -0,0 +1,3 @@ +Hello from .NET regex. +hello is lowercase and will not match this search. +Another Hello appears here. diff --git a/examples/data/recursive/readme.txt b/examples/data/recursive/readme.txt new file mode 100644 index 0000000..595b4ee --- /dev/null +++ b/examples/data/recursive/readme.txt @@ -0,0 +1,2 @@ +Hello from the project root. +Regex keeps patterns consistent. diff --git a/examples/data/recursive/src/ignored.md b/examples/data/recursive/src/ignored.md new file mode 100644 index 0000000..bf66e62 --- /dev/null +++ b/examples/data/recursive/src/ignored.md @@ -0,0 +1 @@ +Hello from Markdown, excluded by the *.txt filter. diff --git a/examples/data/recursive/src/notes.txt b/examples/data/recursive/src/notes.txt new file mode 100644 index 0000000..6fd262a --- /dev/null +++ b/examples/data/recursive/src/notes.txt @@ -0,0 +1,2 @@ +Hello from a nested folder. +hello is lowercase and will match by default. diff --git a/examples/vhs/README.md b/examples/vhs/README.md new file mode 100644 index 0000000..11e6b4b --- /dev/null +++ b/examples/vhs/README.md @@ -0,0 +1,11 @@ +# Example recordings + +The VHS tapes in this directory reproduce the examples shown in the main README. Run them from the repository root with VHS and the .NET 10 SDK installed: + +```sh +vhs examples/vhs/recursive-search.tape +vhs examples/vhs/case-sensitive.tape +vhs examples/vhs/named-replacement.tape +``` + +Each tape writes a GIF and an MP4 to `examples/videos/`. The replacement tape starts from `examples/data/names.txt` each time and removes its temporary working copy when the recording finishes. diff --git a/examples/vhs/case-sensitive.tape b/examples/vhs/case-sensitive.tape new file mode 100644 index 0000000..8c5502b --- /dev/null +++ b/examples/vhs/case-sensitive.tape @@ -0,0 +1,26 @@ +Output examples/videos/case-sensitive.gif +Output examples/videos/case-sensitive.mp4 +Require dotnet + +Set Shell bash +Set FontSize 22 +Set Width 1200 +Set Height 480 +Set Padding 24 +Set Margin 16 +Set MarginFill "#101522" +Set BorderRadius 12 +Set WindowBar Colorful +Set Theme "Catppuccin Mocha" +Set TypingSpeed 45ms + +# Build the CLI quietly and add its apphost to this recording's PATH. +Hide +Type "dotnet build regex/regex.csproj -c Release --nologo >/dev/null && alias regex=./regex/bin/Release/net10.0/regex && clear" +Enter +Sleep 1s +Show + +Type "regex --case-sensitive Hello examples/data/notes.txt" +Enter +Sleep 3s diff --git a/examples/vhs/named-replacement.tape b/examples/vhs/named-replacement.tape new file mode 100644 index 0000000..6a4a25a --- /dev/null +++ b/examples/vhs/named-replacement.tape @@ -0,0 +1,33 @@ +Output examples/videos/named-replacement.gif +Output examples/videos/named-replacement.mp4 +Require dotnet + +Set Shell bash +Set FontSize 22 +Set Width 1200 +Set Height 520 +Set Padding 24 +Set Margin 16 +Set MarginFill "#101522" +Set BorderRadius 12 +Set WindowBar Colorful +Set Theme "Catppuccin Mocha" +Set TypingSpeed 45ms + +# Build quietly, prepare a fresh writable copy, then expose the apphost. +Hide +Type "dotnet build regex/regex.csproj -c Release --nologo >/dev/null && mkdir -p examples/videos/.work && cp examples/data/names.txt examples/videos/.work/names.txt && alias regex=./regex/bin/Release/net10.0/regex && clear" +Enter +Sleep 1s +Show + +Type "regex 'Name:(?[A-Za-z]+)' --replace 'id=$''{name}' --verbose examples/videos/.work/names.txt" +Enter +Sleep 2s +Type "cat examples/videos/.work/names.txt" +Enter +Sleep 3s + +Hide +Type "rm -f examples/videos/.work/names.txt && rmdir examples/videos/.work" +Enter diff --git a/examples/vhs/recursive-search.tape b/examples/vhs/recursive-search.tape new file mode 100644 index 0000000..10df108 --- /dev/null +++ b/examples/vhs/recursive-search.tape @@ -0,0 +1,26 @@ +Output examples/videos/recursive-search.gif +Output examples/videos/recursive-search.mp4 +Require dotnet + +Set Shell bash +Set FontSize 22 +Set Width 1200 +Set Height 480 +Set Padding 24 +Set Margin 16 +Set MarginFill "#101522" +Set BorderRadius 12 +Set WindowBar Colorful +Set Theme "Catppuccin Mocha" +Set TypingSpeed 45ms + +# Build the CLI quietly and add its apphost to this recording's PATH. +Hide +Type "dotnet build regex/regex.csproj -c Release --nologo >/dev/null && alias regex=./regex/bin/Release/net10.0/regex && clear" +Enter +Sleep 1s +Show + +Type "regex --recursive --filter '*.txt' Hello examples/data/recursive/" +Enter +Sleep 3s diff --git a/examples/videos/case-sensitive.gif b/examples/videos/case-sensitive.gif new file mode 100644 index 0000000..f97a0e0 Binary files /dev/null and b/examples/videos/case-sensitive.gif differ diff --git a/examples/videos/case-sensitive.mp4 b/examples/videos/case-sensitive.mp4 new file mode 100644 index 0000000..712c3d7 Binary files /dev/null and b/examples/videos/case-sensitive.mp4 differ diff --git a/examples/videos/named-replacement.gif b/examples/videos/named-replacement.gif new file mode 100644 index 0000000..872f002 Binary files /dev/null and b/examples/videos/named-replacement.gif differ diff --git a/examples/videos/named-replacement.mp4 b/examples/videos/named-replacement.mp4 new file mode 100644 index 0000000..22b9e39 Binary files /dev/null and b/examples/videos/named-replacement.mp4 differ diff --git a/examples/videos/recursive-search.gif b/examples/videos/recursive-search.gif new file mode 100644 index 0000000..7e3dc30 Binary files /dev/null and b/examples/videos/recursive-search.gif differ diff --git a/examples/videos/recursive-search.mp4 b/examples/videos/recursive-search.mp4 new file mode 100644 index 0000000..ca7f4a5 Binary files /dev/null and b/examples/videos/recursive-search.mp4 differ