Skip to content

Commit bff73dd

Browse files
committed
docs: document ref-based remote support in readme
1 parent a7be603 commit bff73dd

1 file changed

Lines changed: 48 additions & 1 deletion

File tree

readme.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ It shines for:
1515
- Quick one-off tools and prototypes
1616
- File-based apps without a `.csproj`
1717
- Fast iteration with smart caching (subsequent runs are near-instant when nothing changed)
18-
- Easy sharing of small utilities (just the `.cs` file)
18+
- Easy sharing of small utilities (just a `.cs` file **or** a remote ref like `owner/repo[@ref][:path]`)
1919

2020

2121
## Usage
@@ -62,6 +62,53 @@ dnx go dev app.cs -- arg1 arg2
6262
dnx go dev app.cs /p:Configuration=Release -- arg1 arg2
6363
```
6464

65+
## Remote references
66+
67+
Instead of a local `.cs` file, you can pass a remote reference. The tool will download
68+
the content (when needed) and treat the resulting local file as the entry point:
69+
70+
```console
71+
# Run from a public repo (defaults to main + program.cs or first .cs)
72+
dnx go kzu/sandbox
73+
74+
# Specific branch/tag and file
75+
dnx go kzu/sandbox@v1.2.3:src/hello.cs
76+
77+
# Full host (GitHub, Gist, GitLab, Azure DevOps)
78+
dnx go github.com/kzu/sandbox@main:hello.cs
79+
dnx go gist.github.com/kzu/0ac826dc7de666546aaedd38e5965381
80+
dnx go gitlab.com/kzu/runcs/-/blob/main/program.cs
81+
```
82+
83+
The first argument is resolved by first checking if it is a local file (`File.Exists`).
84+
If not, it falls back to parsing it as a remote ref (`owner/repo[@ref][:path]`).
85+
86+
Downloaded content is cached under the `dotnet/go` directory (same root as local apps)
87+
and participates in the normal up-to-date checks. By default, a remote ref is
88+
considered fresh for **2 weeks**. After that (or when using `--force` / `--go-force`),
89+
it will be re-downloaded.
90+
91+
```console
92+
# Force a fresh download even if within the 2-week window
93+
dnx go --force kzu/sandbox
94+
95+
# Same using the --go- alias form
96+
dnx go --go-force kzu/sandbox
97+
```
98+
99+
The go-specific switches support both bare and `--go-` prefixed forms for consistency:
100+
101+
- `--force` / `--go-force`
102+
- `--debug` / `--go-debug`
103+
- `--r2r` / `--go-r2r`
104+
105+
Behavior follows the chosen command:
106+
107+
* Default command: downloads (if needed) then `dotnet publish` + execute (AOT by default).
108+
* `dev` command: downloads (if needed) then `dotnet run` for fast iteration.
109+
110+
Arguments after `--` (or all trailing args) are forwarded exactly as with local files.
111+
65112
## Cache and cleaning
66113

67114
`go#` caches build and publish outputs per entry-point file under the

0 commit comments

Comments
 (0)