Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Test

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
scripts:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/setup-dotnet@v6
with:
dotnet-version: 10.0.x
- run: dotnet build dev/tui/Scripts.Tui.csproj --configuration Release
- run: >-
dotnet run --project dev/tui/Scripts.Tui.csproj
--configuration Release --no-build -- --self-test
- if: runner.os == 'Linux'
run: sys/linux/clean --self-test
- if: runner.os == 'macOS'
run: sys/macos/clean --self-test
- if: runner.os == 'Windows'
shell: pwsh
run: ./sys/windows/clean.ps1 -SelfTest
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ node_modules/
.cache/
*.log
*.tmp

# TUI build output
dev/tui/bin/
dev/tui/obj/
70 changes: 69 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,74 @@ Remote execution still fetches the script, but neither example leaves a copy
behind. Requirements differ between scripts; check the script before running
it and use its help text for supported systems and options.

## Interactive Dashboard

The dashboard is useful when you do not remember every flag. It finds the
scripts for you, renders their help pages, guides you through their options,
and shows live output and progress. Cleanup scripts always preview first and
require `CLEAN` before applying.

It needs the
[.NET 10 SDK](https://dotnet.microsoft.com/download/dotnet/10.0). This
macOS/Linux command runs a temporary copy and removes the source and package
cache when the dashboard closes:

```sh
(
work=$(mktemp -d) || exit 1
trap 'rm -rf "$work"' EXIT
curl -fsSL \
'https://github.com/keys-i/scripts/archive/refs/heads/main.tar.gz' |
tar -xz -C "$work" --strip-components=1 &&
DOTNET_CLI_HOME="$work/.dotnet" \
NUGET_PACKAGES="$work/.nuget" \
DOTNET_GENERATE_ASPNET_CERTIFICATE=false \
DOTNET_CLI_TELEMETRY_OPTOUT=1 \
DOTNET_NOLOGO=1 \
dotnet run --project "$work/dev/tui" -- --root "$work"
)
```

On Windows PowerShell:

```powershell
$work = Join-Path ([IO.Path]::GetTempPath()) "scripts-$([guid]::NewGuid())"
$zip = "$work.zip"
$oldCliHome = $env:DOTNET_CLI_HOME
$oldPackages = $env:NUGET_PACKAGES
$oldCertificate = $env:DOTNET_GENERATE_ASPNET_CERTIFICATE
$oldTelemetry = $env:DOTNET_CLI_TELEMETRY_OPTOUT
$oldNoLogo = $env:DOTNET_NOLOGO
try {
Invoke-WebRequest `
'https://github.com/keys-i/scripts/archive/refs/heads/main.zip' `
-OutFile $zip
Expand-Archive $zip -DestinationPath $work
$repo = Join-Path $work 'scripts-main'
$env:DOTNET_CLI_HOME = Join-Path $work '.dotnet'
$env:NUGET_PACKAGES = Join-Path $work '.nuget'
$env:DOTNET_GENERATE_ASPNET_CERTIFICATE = 'false'
$env:DOTNET_CLI_TELEMETRY_OPTOUT = '1'
$env:DOTNET_NOLOGO = '1'
dotnet run --project (Join-Path $repo 'dev/tui') -- --root $repo
} finally {
$env:DOTNET_CLI_HOME = $oldCliHome
$env:NUGET_PACKAGES = $oldPackages
$env:DOTNET_GENERATE_ASPNET_CERTIFICATE = $oldCertificate
$env:DOTNET_CLI_TELEMETRY_OPTOUT = $oldTelemetry
$env:DOTNET_NOLOGO = $oldNoLogo
Remove-Item $work, $zip -Recurse -Force -ErrorAction SilentlyContinue
}
```

The dashboard starts full-screen. Add `--inline` after the final `--root`
argument to keep it in the terminal's normal scrollback. Use `F1` for help,
`F2` to run, and `F3` to filter; the same controls work with a mouse.

On Linux, run `sudo -v` before opening the dashboard if you plan to apply a
cleanup. Password prompts are disabled inside the TUI so they cannot interfere
with terminal input.

> [!CAUTION]
> Read system and cleanup scripts before running them. Use the least privilege
> needed and back up anything you cannot replace.
Expand All @@ -68,4 +136,4 @@ welcome. Read the [contribution rules](docs/CONTRIBUTING.md) before opening a
pull request.

Please report security problems privately by following the
[security policy](SECURITY.md).
[security policy](docs/SECURITY.md).
12 changes: 12 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# TODO

- [x] Commit the interactive C# dashboard on `add/cs-tui`:

```sh
git add .github/workflows/test.yml .gitignore README.md TODO.md \
dev/tui/Scripts.Tui.csproj dev/tui/Program.cs docs/CONTRIBUTING.md \
sys/linux/clean sys/linux/clean.help sys/macos/clean.help \
sys/windows/clean.ps1.help && \
git -c commit.gpgsign=false bkcommit '2016-05-27T16:04:00+10:00' \
-m 'add: interactive C# script dashboard'
```
Loading