Runfile
Run C# programs from gists or remote repositories
Install / Use
/learn @devlooped/RunfileREADME
dnx runfile
Run C# code programs from git repos on GitHub (or gists), GitLab and Azure DevOps, whether public or private, from specific commits, branches or tags (or default branch).
<!-- include https://github.com/devlooped/.github/raw/main/osmf.md -->Open Source Maintenance Fee
To ensure the long-term sustainability of this project, users of this package who generate revenue must pay an Open Source Maintenance Fee. While the source code is freely available under the terms of the License, this package and other aspects of the project require adherence to the Maintenance Fee.
To pay the Maintenance Fee, become a Sponsor at the proper OSMF tier. A single fee covers all of Devlooped packages.
<!-- https://github.com/devlooped/.github/raw/main/osmf.md -->dnx runfile
<!-- #runfile -->Run C# code programs from git repos on GitHub, GitLab and Azure DevOps.
Usage:
[dnx] runfile [OPTIONS] <repoRef> [<appArgs>...]
Arguments:
<REPO_REF> Reference to remote file to run, with format [host/]owner/repo[@ref][:path]
host optional host name ([gist.]github.com|gitlab.com|dev.azure.com, default: github.com)
@ref optional branch, tag, or commit (default: default branch)
:path optional path to file in repo (default: program.cs at repo root)
Examples:
* kzu/sandbox@v1.0.0:run.cs (implied host github.com, explicit tag and file path)
* gitlab.com/kzu/sandbox@main:run.cs (all explicit parts)
* kzu/sandbox (implied host github.com, ref and path defaults)
Can be an alias previously set with --dnx-alias.
<appArgs> Arguments passed to the C# program that is being run.
Options:
--dnx-aot Enable dotnet AOT defaults for run file.cs. Defaults to false.
--dnx-alias ALIAS Assign an alias on first usage which can be used instead of the full ref.
--dnx-debug Launch the debugger before running.
--dnx-force Force download, skipping ETag checking.
Example:
dnx runfile kzu/runfile@v1:run.cs dotnet rocks
View source:
#:package Spectre.Console@*
using Spectre.Console;
AnsiConsole.MarkupLine($"Hello world from [green]dnx[/] [yellow]gist[/] :rocket: [bold italic]{string.Join(' ', args)}[/]");
[!TIP] The repo does not need to be public. Private repos will leverage the same authentication used by your local
gitto access the file, via the Git Credential Manager.
When running different files from the same repo+ref, the download will be performed only once. The last download etag is used to avoid downloading on each run.
<!-- #runfile -->dnx gist
<!-- #gist -->Run C# code programs from GitHub gists.
Usage: [dnx] gist [OPTIONS] <gistRef> [<appArgs>...]
Arguments:
<GIST_REF> Reference to gist file to run, with format owner/gist[@commit][:path]
@commit optional gist commit (default: latest)
:path optional path to file in gist (default: program.cs or first .cs file)
Examples:
* kzu/0ac826dc7de666546aaedd38e5965381 (tip commit and program.cs or first .cs file)
* kzu/0ac826dc7de666546aaedd38e5965381@d8079cf:run.cs (explicit commit and file path)
Can be an alias previously set with --dnx-alias.
<appArgs> Arguments passed to the C# program that is being run.
Options:
--dnx-aot Enable dotnet AOT defaults for run file.cs. Defaults to false.
--dnx-alias ALIAS Assign an alias on first usage which can be used instead of the full ref.
--dnx-debug Launch the debugger before running.
--dnx-force Force download, skipping ETag checking.
[!TIP] The gist does not need to be public. Private repos will leverage the same authentication used by your local
gitto access the file, via the Git Credential Manager.
Example:
dnx gist kzu/52b115ce24c7978ddc33245d4ff840f5 dotnet rocks
View source gist:
#:package Spectre.Console@*
using Spectre.Console;
AnsiConsole.MarkupLine($"Hello world from [green]dnx[/] [yellow]gist[/] :rocket: [bold italic]{string.Join(' ', args)}[/]");
When running different files from the same repo+ref, the download will be performed only once. The last download etag is used to avoid downloading on each run.
<!-- #gist -->Dogfooding
We also produce CI packages from branches and pull requests so you can dogfood builds as quickly as they are produced.
The CI feed is https://pkg.kzu.app/index.json.
The versioning scheme for packages is:
- PR builds: 42.42.0-pr
[NUMBER].[run] - Branch builds: 42.42.0-
[BRANCH].[run] - Main builds: 42.42.[run]-main
Sponsors
<!-- sponsors.md -->
[.
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
