📦 Turbo MoonBit
ded61de parent: cc1f595 added
.memory/handoffs/2026-09-20-load-config.md +17 -0 | new file mode 100644 | ||
| @@ -0,0 +1,17 @@ | ||
| 1 | +# Handoff — 2026-09-20 — `-load-config` (needs turbo-core v1.0.3) | |
| 2 | + | |
| 3 | +## State | |
| 4 | + | |
| 5 | +- `-load-config <url>` wired in `main.go`, three tests in `main_test.go`, docs EN+FR updated. Green under the umbrella `go.work` (`turbo-editors/`), which resolves turbo-core to the local checkout. | |
| 6 | +- **`go.mod` still says turbo-core v1.0.2** — `GOWORK=off make check` fails until turbo-core v1.0.3 is tagged and this is re-pinned. Even under the workspace, the two release-script tests (`TestTheTagScript…`) fail for the same reason: they build a copy of the module outside it. Everything else is green. | |
| 7 | + | |
| 8 | +## Next steps | |
| 9 | + | |
| 10 | +1. When turbo-core v1.0.3 is tagged: `go get rickub.com/turbo-editors/turbo-core@v1.0.3 && go mod tidy && GOWORK=off make check`. | |
| 11 | +2. Try it for real: in an empty directory, `turbo-moonbit -load-config https://rickub.com/turbo-editors/configs/tree/main/golang-init` (the sample repository holds `.turbo-go` only — for this editor a directory with a `.turbo-moonbit` is needed), then start `turbo-moonbit` and check the settings took. | |
| 12 | +3. Then `./01-release.tag.sh` as usual. | |
| 13 | + | |
| 14 | +## Traps | |
| 15 | + | |
| 16 | +- The sample configs repository is `rickub.com/turbo-editors/configs`; its git address is `git.rickub.com`, which `configrepo` tries second. A wrong first candidate costs one `ls-remote`, not the load. | |
| 17 | +- The editor refuses when `.turbo-moonbit` already exists (`configrepo.ErrExists`); there is deliberately no `--force`. | |
| new file mode 100644 | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | +# Handoff — 2026-09-20 — `-load-config` (needs turbo-core v1.0.3) | ||
| 2 | + | ||
| 3 | +## State | ||
| 4 | + | ||
| 5 | +- `-load-config <url>` wired in `main.go`, three tests in `main_test.go`, docs EN+FR updated. Green under the umbrella `go.work` (`turbo-editors/`), which resolves turbo-core to the local checkout. | ||
| 6 | +- **`go.mod` still says turbo-core v1.0.2** — `GOWORK=off make check` fails until turbo-core v1.0.3 is tagged and this is re-pinned. Even under the workspace, the two release-script tests (`TestTheTagScript…`) fail for the same reason: they build a copy of the module outside it. Everything else is green. | ||
| 7 | + | ||
| 8 | +## Next steps | ||
| 9 | + | ||
| 10 | +1. When turbo-core v1.0.3 is tagged: `go get rickub.com/turbo-editors/turbo-core@v1.0.3 && go mod tidy && GOWORK=off make check`. | ||
| 11 | +2. Try it for real: in an empty directory, `turbo-moonbit -load-config https://rickub.com/turbo-editors/configs/tree/main/golang-init` (the sample repository holds `.turbo-go` only — for this editor a directory with a `.turbo-moonbit` is needed), then start `turbo-moonbit` and check the settings took. | ||
| 12 | +3. Then `./01-release.tag.sh` as usual. | ||
| 13 | + | ||
| 14 | +## Traps | ||
| 15 | + | ||
| 16 | +- The sample configs repository is `rickub.com/turbo-editors/configs`; its git address is `git.rickub.com`, which `configrepo` tries second. A wrong first candidate costs one `ls-remote`, not the load. | ||
| 17 | +- The editor refuses when `.turbo-moonbit` already exists (`configrepo.ErrExists`); there is deliberately no `--force`. | ||
modified
.memory/history.md +9 -0 | @@ -113,3 +113,12 @@ One dated entry per session, appended. Never rewritten. | ||
| 113 | 113 | - **Changes here**: the pin replaced by `TestAFileCreatedInTheEditorIsDiagnosedFromItsFirstSaveWithRealMoonLSP` — `editor.Open` on a file not yet on disk, type the broken fixture, `SetAutosave(true, 10 ms)`, wait for the diagnostic; the one exported way to write a buffer without a dialog. `typeText` sends `KeyEnter` for `\n` (it dropped newlines: traced through a tee wrapper around `moon-lsp`, the saved file was one `///|` line). `os` imported. |
| 114 | 114 | - **Fix**: turbo-core v1.0.2 (`lsp.Client.FileCreated`, sent by `announceSaved` when the save created the file). Verified through `go.work` against the local core: the new test passes under `/tmp` and under a symlinked `TMPDIR`; **against the published v1.0.1 it fails** — the falsification. |
| 115 | 115 | - **Next**: when turbo-core v1.0.2 is tagged — `go get rickub.com/turbo-editors/turbo-core@v1.0.2 && go mod tidy && GOWORK=off make check`, then `./01-release.tag.sh`. |
| 116 | + | |
| 117 | +## 2026-09-20 — `-load-config <url>`: a shared `.turbo-moonbit` fetched from a repository | |
| 118 | + | |
| 119 | +- **Asked** (umbrella session, ticket #25 of `turbo-editors/.tickets`): `turbo-moonbit --load-config <forge URL>` fetches the `.turbo-moonbit` found at that directory of the repository and copies it into the working directory; the same for every Turbo editor with its own directory name. | |
| 120 | +- **Changes**: `main.go` — `loadConfig` option and flag, `case opts.loadConfig != ""` in `run`, `loadConfig` and `describeLoad`; the work itself is turbo-core's new `configrepo` package (git ls-remote + shallow clone; rickub, GitHub, GitLab, Codeberg URLs). `main_test.go` — three tests (`describeLoad` ×2, `loadConfig` refuses when `.turbo-moonbit` exists, no network needed). Docs: `docs/{en,fr}/reference/cli.md` (flag, example, files, errors), `docs/{en,fr}/how-to/configure-a-project.md` (new section). | |
| 121 | +- **Depends on turbo-core v1.0.3**, not yet tagged: `go.mod` still pins v1.0.2, so this builds only under the umbrella `go.work` (`turbo-editors/README.md` explains) until `go get rickub.com/turbo-editors/turbo-core@v1.0.3 && go mod tidy`. Verified with `make check` under that workspace. | |
| 122 | +- **Not done**: not committed; go.mod not re-pinned; not run against a real terminal. | |
| 123 | +- **Correction, same session**: under the workspace everything passes **except `TestTheTagScriptTagsAndPushesForReal` and `TestTheTagScriptRefusesATagItAlreadyPublished`** — they copy the module elsewhere and run `make check` there, outside the workspace, where turbo-core v1.0.2 from the proxy has no `configrepo`. They go green the moment `go.mod` is re-pinned to v1.0.3. The package diagram (`docs/diagrams/packages.drawio`, where the module has one) gained a `configrepo` box and a `main → configrepo` arrow, which its own test demanded. | |
| 124 | + | |
| @@ -113,3 +113,12 @@ One dated entry per session, appended. Never rewritten. | |||
| 113 | - **Changes here**: the pin replaced by `TestAFileCreatedInTheEditorIsDiagnosedFromItsFirstSaveWithRealMoonLSP` — `editor.Open` on a file not yet on disk, type the broken fixture, `SetAutosave(true, 10 ms)`, wait for the diagnostic; the one exported way to write a buffer without a dialog. `typeText` sends `KeyEnter` for `\n` (it dropped newlines: traced through a tee wrapper around `moon-lsp`, the saved file was one `///|` line). `os` imported. | 113 | - **Changes here**: the pin replaced by `TestAFileCreatedInTheEditorIsDiagnosedFromItsFirstSaveWithRealMoonLSP` — `editor.Open` on a file not yet on disk, type the broken fixture, `SetAutosave(true, 10 ms)`, wait for the diagnostic; the one exported way to write a buffer without a dialog. `typeText` sends `KeyEnter` for `\n` (it dropped newlines: traced through a tee wrapper around `moon-lsp`, the saved file was one `///|` line). `os` imported. |
| 114 | - **Fix**: turbo-core v1.0.2 (`lsp.Client.FileCreated`, sent by `announceSaved` when the save created the file). Verified through `go.work` against the local core: the new test passes under `/tmp` and under a symlinked `TMPDIR`; **against the published v1.0.1 it fails** — the falsification. | 114 | - **Fix**: turbo-core v1.0.2 (`lsp.Client.FileCreated`, sent by `announceSaved` when the save created the file). Verified through `go.work` against the local core: the new test passes under `/tmp` and under a symlinked `TMPDIR`; **against the published v1.0.1 it fails** — the falsification. |
| 115 | - **Next**: when turbo-core v1.0.2 is tagged — `go get rickub.com/turbo-editors/turbo-core@v1.0.2 && go mod tidy && GOWORK=off make check`, then `./01-release.tag.sh`. | 115 | - **Next**: when turbo-core v1.0.2 is tagged — `go get rickub.com/turbo-editors/turbo-core@v1.0.2 && go mod tidy && GOWORK=off make check`, then `./01-release.tag.sh`. |
| 116 | + | ||
| 117 | +## 2026-09-20 — `-load-config <url>`: a shared `.turbo-moonbit` fetched from a repository | ||
| 118 | + | ||
| 119 | +- **Asked** (umbrella session, ticket #25 of `turbo-editors/.tickets`): `turbo-moonbit --load-config <forge URL>` fetches the `.turbo-moonbit` found at that directory of the repository and copies it into the working directory; the same for every Turbo editor with its own directory name. | ||
| 120 | +- **Changes**: `main.go` — `loadConfig` option and flag, `case opts.loadConfig != ""` in `run`, `loadConfig` and `describeLoad`; the work itself is turbo-core's new `configrepo` package (git ls-remote + shallow clone; rickub, GitHub, GitLab, Codeberg URLs). `main_test.go` — three tests (`describeLoad` ×2, `loadConfig` refuses when `.turbo-moonbit` exists, no network needed). Docs: `docs/{en,fr}/reference/cli.md` (flag, example, files, errors), `docs/{en,fr}/how-to/configure-a-project.md` (new section). | ||
| 121 | +- **Depends on turbo-core v1.0.3**, not yet tagged: `go.mod` still pins v1.0.2, so this builds only under the umbrella `go.work` (`turbo-editors/README.md` explains) until `go get rickub.com/turbo-editors/turbo-core@v1.0.3 && go mod tidy`. Verified with `make check` under that workspace. | ||
| 122 | +- **Not done**: not committed; go.mod not re-pinned; not run against a real terminal. | ||
| 123 | +- **Correction, same session**: under the workspace everything passes **except `TestTheTagScriptTagsAndPushesForReal` and `TestTheTagScriptRefusesATagItAlreadyPublished`** — they copy the module elsewhere and run `make check` there, outside the workspace, where turbo-core v1.0.2 from the proxy has no `configrepo`. They go green the moment `go.mod` is re-pinned to v1.0.3. The package diagram (`docs/diagrams/packages.drawio`, where the module has one) gained a `configrepo` box and a `main → configrepo` arrow, which its own test demanded. | ||
| 124 | + | ||
modified
.memory/summary.md +5 -0 | @@ -109,3 +109,8 @@ go list -f '{{.Dir}}' rickub.com/turbo-editors/turbo-core/app # must NOT be un | ||
| 109 | 109 | - **Module path `rickub.com/turbo-editors/turbo-moonbit`**, depending on `rickub.com/turbo-editors/turbo-core v1.0.0` — the first turbo-core version published under that path (`v0.9.0` on the proxy still declares the Codeberg path and cannot be required as `rickub.com/…`). Every import, the Makefile's `VERSION_PKG`, `scripts/install.sh`, the README and the docs say `rickub.com`. `GOWORK=off make check` green. The repository on this side is a fresh `git init` with `origin` at `ssh://git@rickub.com/turbo-editors/turbo-moonbit.git` and **no commit yet**; `01-release.tag.sh` makes the first one. |
| 110 | 110 | - **Releases are one script and one workflow**, modelled on turbo-core's and identical to turbo-go's. `01-release.tag.sh` runs `make check` under `TURBO_MOONBIT_RELEASING=1`, refuses a tag taken locally or on origin (bump, never move), refuses a `replace` in `go.mod`, commits, pushes the current branch, then tags and pushes the tag. That push starts `.github/workflows/release.yml`: `go test` with `TURBO_MOONBIT_RELEASING=1`, `./02-build-releases.sh "${GITHUB_REF_NAME}"`, release notes from the tag message, a run artifact, then `softprops/action-gh-release@v2` attaching `turbo-moonbit-*`, `SHA256SUMS` and `README.md` with the job's own `GITHUB_TOKEN` — the only credential Rickub's release API accepts. **`02-release.publish.sh` and `04-release.upload-binaries.sh` are gone**; the build script is now `02-build-releases.sh`, takes the tag as `$1` (CI has no `release.env`), validates it, refuses a `replace`, and starts from an empty `release/${TAG}/`. `release.env` holds only `TAG` and `ABOUT`; `turbo-moonbit.token.env` is read by nothing. |
| 111 | 111 | - **`release_test.go`** runs `01` for real against a throwaway bare remote (publishes, then refuses the same tag), runs `02` alone to see it refuse `v0.o.0`, and asserts the workflow's trigger, `contents: write`, `./02-build-releases.sh`, `fail_on_unmatched_files`, docs linked at the tag, no `secrets.`, and `TURBO_MOONBIT_RELEASING`. The copy of the module for the clone leaves out `.git`, `bin`, `release`, `kits`, `demo`, `demos`, `*.env` and `go.work*`; children run with `GOWORK=off`. |
| 112 | + | |
| 113 | +## State as of 2026-09-20 | |
| 114 | + | |
| 115 | +- **`-load-config <url>` is wired** (`main.go`: `loadConfig`, `describeLoad`), on top of turbo-core's `configrepo`. It needs **turbo-core v1.0.3**, which is not tagged yet; `go.mod` pins v1.0.2, so the editor builds only under the umbrella `go.work` until re-pinned. A project with a `.turbo-moonbit` already is refused, not overwritten. | |
| 116 | + | |
| @@ -109,3 +109,8 @@ go list -f '{{.Dir}}' rickub.com/turbo-editors/turbo-core/app # must NOT be un | |||
| 109 | - **Module path `rickub.com/turbo-editors/turbo-moonbit`**, depending on `rickub.com/turbo-editors/turbo-core v1.0.0` — the first turbo-core version published under that path (`v0.9.0` on the proxy still declares the Codeberg path and cannot be required as `rickub.com/…`). Every import, the Makefile's `VERSION_PKG`, `scripts/install.sh`, the README and the docs say `rickub.com`. `GOWORK=off make check` green. The repository on this side is a fresh `git init` with `origin` at `ssh://git@rickub.com/turbo-editors/turbo-moonbit.git` and **no commit yet**; `01-release.tag.sh` makes the first one. | 109 | - **Module path `rickub.com/turbo-editors/turbo-moonbit`**, depending on `rickub.com/turbo-editors/turbo-core v1.0.0` — the first turbo-core version published under that path (`v0.9.0` on the proxy still declares the Codeberg path and cannot be required as `rickub.com/…`). Every import, the Makefile's `VERSION_PKG`, `scripts/install.sh`, the README and the docs say `rickub.com`. `GOWORK=off make check` green. The repository on this side is a fresh `git init` with `origin` at `ssh://git@rickub.com/turbo-editors/turbo-moonbit.git` and **no commit yet**; `01-release.tag.sh` makes the first one. |
| 110 | - **Releases are one script and one workflow**, modelled on turbo-core's and identical to turbo-go's. `01-release.tag.sh` runs `make check` under `TURBO_MOONBIT_RELEASING=1`, refuses a tag taken locally or on origin (bump, never move), refuses a `replace` in `go.mod`, commits, pushes the current branch, then tags and pushes the tag. That push starts `.github/workflows/release.yml`: `go test` with `TURBO_MOONBIT_RELEASING=1`, `./02-build-releases.sh "${GITHUB_REF_NAME}"`, release notes from the tag message, a run artifact, then `softprops/action-gh-release@v2` attaching `turbo-moonbit-*`, `SHA256SUMS` and `README.md` with the job's own `GITHUB_TOKEN` — the only credential Rickub's release API accepts. **`02-release.publish.sh` and `04-release.upload-binaries.sh` are gone**; the build script is now `02-build-releases.sh`, takes the tag as `$1` (CI has no `release.env`), validates it, refuses a `replace`, and starts from an empty `release/${TAG}/`. `release.env` holds only `TAG` and `ABOUT`; `turbo-moonbit.token.env` is read by nothing. | 110 | - **Releases are one script and one workflow**, modelled on turbo-core's and identical to turbo-go's. `01-release.tag.sh` runs `make check` under `TURBO_MOONBIT_RELEASING=1`, refuses a tag taken locally or on origin (bump, never move), refuses a `replace` in `go.mod`, commits, pushes the current branch, then tags and pushes the tag. That push starts `.github/workflows/release.yml`: `go test` with `TURBO_MOONBIT_RELEASING=1`, `./02-build-releases.sh "${GITHUB_REF_NAME}"`, release notes from the tag message, a run artifact, then `softprops/action-gh-release@v2` attaching `turbo-moonbit-*`, `SHA256SUMS` and `README.md` with the job's own `GITHUB_TOKEN` — the only credential Rickub's release API accepts. **`02-release.publish.sh` and `04-release.upload-binaries.sh` are gone**; the build script is now `02-build-releases.sh`, takes the tag as `$1` (CI has no `release.env`), validates it, refuses a `replace`, and starts from an empty `release/${TAG}/`. `release.env` holds only `TAG` and `ABOUT`; `turbo-moonbit.token.env` is read by nothing. |
| 111 | - **`release_test.go`** runs `01` for real against a throwaway bare remote (publishes, then refuses the same tag), runs `02` alone to see it refuse `v0.o.0`, and asserts the workflow's trigger, `contents: write`, `./02-build-releases.sh`, `fail_on_unmatched_files`, docs linked at the tag, no `secrets.`, and `TURBO_MOONBIT_RELEASING`. The copy of the module for the clone leaves out `.git`, `bin`, `release`, `kits`, `demo`, `demos`, `*.env` and `go.work*`; children run with `GOWORK=off`. | 111 | - **`release_test.go`** runs `01` for real against a throwaway bare remote (publishes, then refuses the same tag), runs `02` alone to see it refuse `v0.o.0`, and asserts the workflow's trigger, `contents: write`, `./02-build-releases.sh`, `fail_on_unmatched_files`, docs linked at the tag, no `secrets.`, and `TURBO_MOONBIT_RELEASING`. The copy of the module for the clone leaves out `.git`, `bin`, `release`, `kits`, `demo`, `demos`, `*.env` and `go.work*`; children run with `GOWORK=off`. |
| 112 | + | ||
| 113 | +## State as of 2026-09-20 | ||
| 114 | + | ||
| 115 | +- **`-load-config <url>` is wired** (`main.go`: `loadConfig`, `describeLoad`), on top of turbo-core's `configrepo`. It needs **turbo-core v1.0.3**, which is not tagged yet; `go.mod` pins v1.0.2, so the editor builds only under the umbrella `go.work` until re-pinned. A project with a `.turbo-moonbit` already is refused, not overwritten. | ||
| 116 | + | ||
added
INSTALL.MACOS.md +11 -0 | new file mode 100644 | ||
| @@ -0,0 +1,11 @@ | ||
| 1 | +# Install `turbo-moonbit` on macOS | |
| 2 | + | |
| 3 | +```bash | |
| 4 | +# download the binary release in https://rickub.com/turbo-editors/turbo-moonbit/releases | |
| 5 | +VERSION=1.0.3 | |
| 6 | +curl -fsSLO "https://rickub.com/turbo-editors/turbo-moonbit/releases/download/v${VERSION}/turbo-moonbit-${VERSION}-darwin-arm64" | |
| 7 | +chmod +x ./turbo-moonbit-${VERSION}-darwin-arm64 | |
| 8 | +xattr -cr ./turbo-moonbit-${VERSION}-darwin-arm64 | |
| 9 | +sudo rm /usr/local/bin/turbo-moonbit | |
| 10 | +sudo cp ./turbo-moonbit-${VERSION}-darwin-arm64 /usr/local/bin/turbo-moonbit | |
| 11 | +``` | |
| \ No newline at end of file | ||
| new file mode 100644 | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | +# Install `turbo-moonbit` on macOS | ||
| 2 | + | ||
| 3 | +```bash | ||
| 4 | +# download the binary release in https://rickub.com/turbo-editors/turbo-moonbit/releases | ||
| 5 | +VERSION=1.0.3 | ||
| 6 | +curl -fsSLO "https://rickub.com/turbo-editors/turbo-moonbit/releases/download/v${VERSION}/turbo-moonbit-${VERSION}-darwin-arm64" | ||
| 7 | +chmod +x ./turbo-moonbit-${VERSION}-darwin-arm64 | ||
| 8 | +xattr -cr ./turbo-moonbit-${VERSION}-darwin-arm64 | ||
| 9 | +sudo rm /usr/local/bin/turbo-moonbit | ||
| 10 | +sudo cp ./turbo-moonbit-${VERSION}-darwin-arm64 /usr/local/bin/turbo-moonbit | ||
| 11 | +``` | ||
| \ No newline at end of file | \ No newline at end of file | ||
modified
docs/diagrams/packages.drawio +2 -0 | @@ -13,6 +13,7 @@ | ||
| 13 | 13 | <mxCell id="8" value="<b>theme</b><br/><font style='font-size:9px'>turbo-core</font>" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=11;" vertex="1" parent="1"><mxGeometry x="329" y="260" width="190" height="54" as="geometry"/></mxCell> |
| 14 | 14 | <mxCell id="9" value="<b>version</b><br/><font style='font-size:9px'>turbo-core</font>" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=11;" vertex="1" parent="1"><mxGeometry x="-95" y="390" width="190" height="54" as="geometry"/></mxCell> |
| 15 | 15 | <mxCell id="10" value="tcell/v2" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#999999;dashed=1;fontSize=11;" vertex="1" parent="1"><mxGeometry x="-95" y="520" width="190" height="54" as="geometry"/></mxCell> |
| 16 | + <mxCell id="20" value="<b>configrepo</b><br/><font style='font-size:9px'>turbo-core</font>" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=11;" vertex="1" parent="1"><mxGeometry x="117" y="390" width="190" height="54" as="geometry"/></mxCell> | |
| 16 | 17 | <mxCell id="e11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="3" target="5"><mxGeometry relative="1" as="geometry"/></mxCell> |
| 17 | 18 | <mxCell id="e12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="3" target="7"><mxGeometry relative="1" as="geometry"/></mxCell> |
| 18 | 19 | <mxCell id="e13" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="2" target="3"><mxGeometry relative="1" as="geometry"/></mxCell> |
| @@ -22,6 +23,7 @@ | ||
| 22 | 23 | <mxCell id="e17" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="2" target="6"><mxGeometry relative="1" as="geometry"/></mxCell> |
| 23 | 24 | <mxCell id="e18" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="2" target="8"><mxGeometry relative="1" as="geometry"/></mxCell> |
| 24 | 25 | <mxCell id="e19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="2" target="9"><mxGeometry relative="1" as="geometry"/></mxCell> |
| 26 | + <mxCell id="e20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="2" target="20"><mxGeometry relative="1" as="geometry"/></mxCell> | |
| 25 | 27 | </root> |
| 26 | 28 | </mxGraphModel> |
| 27 | 29 | </diagram> |
| @@ -13,6 +13,7 @@ | |||
| 13 | <mxCell id="8" value="<b>theme</b><br/><font style='font-size:9px'>turbo-core</font>" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=11;" vertex="1" parent="1"><mxGeometry x="329" y="260" width="190" height="54" as="geometry"/></mxCell> | 13 | <mxCell id="8" value="<b>theme</b><br/><font style='font-size:9px'>turbo-core</font>" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=11;" vertex="1" parent="1"><mxGeometry x="329" y="260" width="190" height="54" as="geometry"/></mxCell> |
| 14 | <mxCell id="9" value="<b>version</b><br/><font style='font-size:9px'>turbo-core</font>" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=11;" vertex="1" parent="1"><mxGeometry x="-95" y="390" width="190" height="54" as="geometry"/></mxCell> | 14 | <mxCell id="9" value="<b>version</b><br/><font style='font-size:9px'>turbo-core</font>" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=11;" vertex="1" parent="1"><mxGeometry x="-95" y="390" width="190" height="54" as="geometry"/></mxCell> |
| 15 | <mxCell id="10" value="tcell/v2" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#999999;dashed=1;fontSize=11;" vertex="1" parent="1"><mxGeometry x="-95" y="520" width="190" height="54" as="geometry"/></mxCell> | 15 | <mxCell id="10" value="tcell/v2" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#999999;dashed=1;fontSize=11;" vertex="1" parent="1"><mxGeometry x="-95" y="520" width="190" height="54" as="geometry"/></mxCell> |
| 16 | + <mxCell id="20" value="<b>configrepo</b><br/><font style='font-size:9px'>turbo-core</font>" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=11;" vertex="1" parent="1"><mxGeometry x="117" y="390" width="190" height="54" as="geometry"/></mxCell> | ||
| 16 | <mxCell id="e11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="3" target="5"><mxGeometry relative="1" as="geometry"/></mxCell> | 17 | <mxCell id="e11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="3" target="5"><mxGeometry relative="1" as="geometry"/></mxCell> |
| 17 | <mxCell id="e12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="3" target="7"><mxGeometry relative="1" as="geometry"/></mxCell> | 18 | <mxCell id="e12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="3" target="7"><mxGeometry relative="1" as="geometry"/></mxCell> |
| 18 | <mxCell id="e13" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="2" target="3"><mxGeometry relative="1" as="geometry"/></mxCell> | 19 | <mxCell id="e13" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="2" target="3"><mxGeometry relative="1" as="geometry"/></mxCell> |
| @@ -22,6 +23,7 @@ | |||
| 22 | <mxCell id="e17" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="2" target="6"><mxGeometry relative="1" as="geometry"/></mxCell> | 23 | <mxCell id="e17" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="2" target="6"><mxGeometry relative="1" as="geometry"/></mxCell> |
| 23 | <mxCell id="e18" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="2" target="8"><mxGeometry relative="1" as="geometry"/></mxCell> | 24 | <mxCell id="e18" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="2" target="8"><mxGeometry relative="1" as="geometry"/></mxCell> |
| 24 | <mxCell id="e19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="2" target="9"><mxGeometry relative="1" as="geometry"/></mxCell> | 25 | <mxCell id="e19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="2" target="9"><mxGeometry relative="1" as="geometry"/></mxCell> |
| 26 | + <mxCell id="e20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;endFill=1;strokeColor=#6c8ebf;" edge="1" parent="1" source="2" target="20"><mxGeometry relative="1" as="geometry"/></mxCell> | ||
| 25 | </root> | 27 | </root> |
| 26 | </mxGraphModel> | 28 | </mxGraphModel> |
| 27 | </diagram> | 29 | </diagram> |
modified
docs/en/how-to/configure-a-project.md +13 -0 | @@ -70,6 +70,19 @@ turbo-moonbit -theme turbo-dark main.mbt | ||
| 70 | 70 | |
| 71 | 71 | **Options ▸ Project settings…** opens it again. It is greyed out in a project that has none. |
| 72 | 72 | |
| 73 | +## Start from a shared configuration | |
| 74 | + | |
| 75 | +A team can keep ready-made configurations in a repository — one directory per kind of project, each with a `.turbo-moonbit` inside. Point the editor at the directory, with the URL the browser shows, and it copies that `.turbo-moonbit` into the current directory: | |
| 76 | + | |
| 77 | +```bash | |
| 78 | +cd my-project | |
| 79 | +turbo-moonbit -load-config https://rickub.com/turbo-editors/configs/tree/main/golang-init | |
| 80 | +``` | |
| 81 | + | |
| 82 | +It prints what arrived and exits; the next `turbo-moonbit` opens the project with those settings, snippets and tools in force. The URL may be on rickub, GitHub, GitLab or Codeberg, and may point at the directory, at the `.turbo-moonbit` inside it, or at the repository itself for its root on the default branch. `git` must be installed: the fetch is a shallow clone. | |
| 83 | + | |
| 84 | +A project that already has a `.turbo-moonbit` is left alone — the editor refuses rather than overwrite what the project decided. Move the directory away first if you mean to replace it. | |
| 85 | + | |
| 73 | 86 | ## Variants |
| 74 | 87 | |
| 75 | 88 | - **You start the editor from a subdirectory.** The settings are not found: only `./.turbo-moonbit` is looked at, with no walk up towards the project root. Start from the project's own directory, or pass `-theme` for that run. |
| @@ -70,6 +70,19 @@ turbo-moonbit -theme turbo-dark main.mbt | |||
| 70 | 70 | ||
| 71 | **Options ▸ Project settings…** opens it again. It is greyed out in a project that has none. | 71 | **Options ▸ Project settings…** opens it again. It is greyed out in a project that has none. |
| 72 | 72 | ||
| 73 | +## Start from a shared configuration | ||
| 74 | + | ||
| 75 | +A team can keep ready-made configurations in a repository — one directory per kind of project, each with a `.turbo-moonbit` inside. Point the editor at the directory, with the URL the browser shows, and it copies that `.turbo-moonbit` into the current directory: | ||
| 76 | + | ||
| 77 | +```bash | ||
| 78 | +cd my-project | ||
| 79 | +turbo-moonbit -load-config https://rickub.com/turbo-editors/configs/tree/main/golang-init | ||
| 80 | +``` | ||
| 81 | + | ||
| 82 | +It prints what arrived and exits; the next `turbo-moonbit` opens the project with those settings, snippets and tools in force. The URL may be on rickub, GitHub, GitLab or Codeberg, and may point at the directory, at the `.turbo-moonbit` inside it, or at the repository itself for its root on the default branch. `git` must be installed: the fetch is a shallow clone. | ||
| 83 | + | ||
| 84 | +A project that already has a `.turbo-moonbit` is left alone — the editor refuses rather than overwrite what the project decided. Move the directory away first if you mean to replace it. | ||
| 85 | + | ||
| 73 | ## Variants | 86 | ## Variants |
| 74 | 87 | ||
| 75 | - **You start the editor from a subdirectory.** The settings are not found: only `./.turbo-moonbit` is looked at, with no walk up towards the project root. Start from the project's own directory, or pass `-theme` for that run. | 88 | - **You start the editor from a subdirectory.** The settings are not found: only `./.turbo-moonbit` is looked at, with no walk up towards the project root. Start from the project's own directory, or pass `-theme` for that run. |
modified
docs/en/reference/cli.md +7 -0 | @@ -18,6 +18,7 @@ Each `file` is opened in its own window. A file that does not exist yet is opene | ||
| 18 | 18 | | `-list-themes` | bool | `false` | Print every loadable theme with its description, then the user theme directory, and exit. | |
| 19 | 19 | | `-no-lsp` | bool | `false` | Do not start a language server. Colouring and editing are unaffected. | |
| 20 | 20 | | `-version` | bool | `false` | Print `Turbo MoonBit <version>` on one line, with the commit and build date when the build recorded them, and exit. See [the version number](versioning.md). | |
| 21 | +| `-load-config <url>` | string | none | Copy the `.turbo-moonbit` directory found at a repository URL — rickub, GitHub, GitLab or Codeberg, the URL of the directory as the browser shows it — into the working directory, print what arrived, and exit. Needs `git`. Refuses when `./.turbo-moonbit` already exists. The editor is not started. | | |
| 21 | 22 | | `-h`, `-help` | bool | `false` | Print the flag list and exit. | |
| 22 | 23 | |
| 23 | 24 | ## Environment |
| @@ -34,6 +35,7 @@ Each `file` is opened in its own window. A file that does not exist yet is opene | ||
| 34 | 35 | | --- | --- | |
| 35 | 36 | | `$TURBO_MOONBIT_THEME_DIR/*.toml` | User themes, when the variable is set. | |
| 36 | 37 | | `./.turbo-moonbit/settings.toml` | This project's settings, read once at start-up. See [project settings](project-settings.md). | |
| 38 | +| `./.turbo-moonbit/` (written) | Created by `-load-config` from a repository's copy, when the project has none yet. | | |
| 37 | 39 | | `~/.config/turbo-moonbit/themes/*.toml` | User themes on Linux (`os.UserConfigDir`). | |
| 38 | 40 | | `~/Library/Application Support/turbo-moonbit/themes/*.toml` | User themes on macOS. | |
| 39 | 41 | | `<module>/moon.mod`, `<module>/moon.mod.json` | Located by walking up from the first file; the nearest directory holding either becomes the language server's root. | |
| @@ -72,6 +74,7 @@ turbo-moonbit main.mbt moon.mod # two windows | ||
| 72 | 74 | turbo-moonbit -theme turbo-dark main.mbt # a different theme |
| 73 | 75 | turbo-moonbit -no-lsp main.mbt # no language server |
| 74 | 76 | turbo-moonbit -list-themes # what themes exist |
| 77 | +turbo-moonbit -load-config https://rickub.com/turbo-editors/configs/tree/main/golang-init # start from a shared configuration | |
| 75 | 78 | ``` |
| 76 | 79 | |
| 77 | 80 | ## Installer |
| @@ -98,3 +101,7 @@ turbo-moonbit -list-themes # what themes exist | ||
| 98 | 101 | | `turbo-moonbit: initialising the terminal: …` | The terminal was opened but could not be put into raw mode. | |
| 99 | 102 | | `Cannot open` (in a dialog) | The path is a directory, or is not readable. | |
| 100 | 103 | | `Cannot save` (in a dialog) | The directory does not exist, or is not writable. | |
| 104 | +| `turbo-moonbit: configrepo: the project already has a configuration directory: …` | `-load-config` into a project that already has `.turbo-moonbit`. Move it away first. | | |
| 105 | +| `turbo-moonbit: configrepo: git is not installed` | `-load-config` needs the `git` command on `PATH`. | | |
| 106 | +| `turbo-moonbit: configrepo: no configuration directory at that path: …` | The repository was found but holds no `.turbo-moonbit` where the URL points. | | |
| 107 | +| `turbo-moonbit: configrepo: no repository answered: …` | No clone address for that URL answered; the URL, the network, or a private repository. | | |
| @@ -18,6 +18,7 @@ Each `file` is opened in its own window. A file that does not exist yet is opene | |||
| 18 | | `-list-themes` | bool | `false` | Print every loadable theme with its description, then the user theme directory, and exit. | | 18 | | `-list-themes` | bool | `false` | Print every loadable theme with its description, then the user theme directory, and exit. | |
| 19 | | `-no-lsp` | bool | `false` | Do not start a language server. Colouring and editing are unaffected. | | 19 | | `-no-lsp` | bool | `false` | Do not start a language server. Colouring and editing are unaffected. | |
| 20 | | `-version` | bool | `false` | Print `Turbo MoonBit <version>` on one line, with the commit and build date when the build recorded them, and exit. See [the version number](versioning.md). | | 20 | | `-version` | bool | `false` | Print `Turbo MoonBit <version>` on one line, with the commit and build date when the build recorded them, and exit. See [the version number](versioning.md). | |
| 21 | +| `-load-config <url>` | string | none | Copy the `.turbo-moonbit` directory found at a repository URL — rickub, GitHub, GitLab or Codeberg, the URL of the directory as the browser shows it — into the working directory, print what arrived, and exit. Needs `git`. Refuses when `./.turbo-moonbit` already exists. The editor is not started. | | ||
| 21 | | `-h`, `-help` | bool | `false` | Print the flag list and exit. | | 22 | | `-h`, `-help` | bool | `false` | Print the flag list and exit. | |
| 22 | 23 | ||
| 23 | ## Environment | 24 | ## Environment |
| @@ -34,6 +35,7 @@ Each `file` is opened in its own window. A file that does not exist yet is opene | |||
| 34 | | --- | --- | | 35 | | --- | --- | |
| 35 | | `$TURBO_MOONBIT_THEME_DIR/*.toml` | User themes, when the variable is set. | | 36 | | `$TURBO_MOONBIT_THEME_DIR/*.toml` | User themes, when the variable is set. | |
| 36 | | `./.turbo-moonbit/settings.toml` | This project's settings, read once at start-up. See [project settings](project-settings.md). | | 37 | | `./.turbo-moonbit/settings.toml` | This project's settings, read once at start-up. See [project settings](project-settings.md). | |
| 38 | +| `./.turbo-moonbit/` (written) | Created by `-load-config` from a repository's copy, when the project has none yet. | | ||
| 37 | | `~/.config/turbo-moonbit/themes/*.toml` | User themes on Linux (`os.UserConfigDir`). | | 39 | | `~/.config/turbo-moonbit/themes/*.toml` | User themes on Linux (`os.UserConfigDir`). | |
| 38 | | `~/Library/Application Support/turbo-moonbit/themes/*.toml` | User themes on macOS. | | 40 | | `~/Library/Application Support/turbo-moonbit/themes/*.toml` | User themes on macOS. | |
| 39 | | `<module>/moon.mod`, `<module>/moon.mod.json` | Located by walking up from the first file; the nearest directory holding either becomes the language server's root. | | 41 | | `<module>/moon.mod`, `<module>/moon.mod.json` | Located by walking up from the first file; the nearest directory holding either becomes the language server's root. | |
| @@ -72,6 +74,7 @@ turbo-moonbit main.mbt moon.mod # two windows | |||
| 72 | turbo-moonbit -theme turbo-dark main.mbt # a different theme | 74 | turbo-moonbit -theme turbo-dark main.mbt # a different theme |
| 73 | turbo-moonbit -no-lsp main.mbt # no language server | 75 | turbo-moonbit -no-lsp main.mbt # no language server |
| 74 | turbo-moonbit -list-themes # what themes exist | 76 | turbo-moonbit -list-themes # what themes exist |
| 77 | +turbo-moonbit -load-config https://rickub.com/turbo-editors/configs/tree/main/golang-init # start from a shared configuration | ||
| 75 | ``` | 78 | ``` |
| 76 | 79 | ||
| 77 | ## Installer | 80 | ## Installer |
| @@ -98,3 +101,7 @@ turbo-moonbit -list-themes # what themes exist | |||
| 98 | | `turbo-moonbit: initialising the terminal: …` | The terminal was opened but could not be put into raw mode. | | 101 | | `turbo-moonbit: initialising the terminal: …` | The terminal was opened but could not be put into raw mode. | |
| 99 | | `Cannot open` (in a dialog) | The path is a directory, or is not readable. | | 102 | | `Cannot open` (in a dialog) | The path is a directory, or is not readable. | |
| 100 | | `Cannot save` (in a dialog) | The directory does not exist, or is not writable. | | 103 | | `Cannot save` (in a dialog) | The directory does not exist, or is not writable. | |
| 104 | +| `turbo-moonbit: configrepo: the project already has a configuration directory: …` | `-load-config` into a project that already has `.turbo-moonbit`. Move it away first. | | ||
| 105 | +| `turbo-moonbit: configrepo: git is not installed` | `-load-config` needs the `git` command on `PATH`. | | ||
| 106 | +| `turbo-moonbit: configrepo: no configuration directory at that path: …` | The repository was found but holds no `.turbo-moonbit` where the URL points. | | ||
| 107 | +| `turbo-moonbit: configrepo: no repository answered: …` | No clone address for that URL answered; the URL, the network, or a private repository. | | ||
modified
docs/fr/how-to/configure-a-project.md +13 -0 | @@ -70,6 +70,19 @@ turbo-moonbit -theme turbo-dark main.mbt | ||
| 70 | 70 | |
| 71 | 71 | **Options ▸ Project settings…** le rouvre. L'entrée est grisée dans un projet qui n'en a pas. |
| 72 | 72 | |
| 73 | +## Partir d'une configuration partagée | |
| 74 | + | |
| 75 | +Une équipe peut garder des configurations toutes prêtes dans un dépôt — un dossier par sorte de projet, chacun avec un `.turbo-moonbit` dedans. Donnez à l'éditeur l'URL du dossier, telle que le navigateur l'affiche, et il copie ce `.turbo-moonbit` dans le répertoire courant : | |
| 76 | + | |
| 77 | +```bash | |
| 78 | +cd mon-projet | |
| 79 | +turbo-moonbit -load-config https://rickub.com/turbo-editors/configs/tree/main/golang-init | |
| 80 | +``` | |
| 81 | + | |
| 82 | +Il affiche ce qui est arrivé et quitte ; le `turbo-moonbit` suivant ouvre le projet avec ces réglages, extraits et outils en vigueur. L'URL peut être sur rickub, GitHub, GitLab ou Codeberg, et pointer sur le dossier, sur le `.turbo-moonbit` qu'il contient, ou sur le dépôt lui-même pour sa racine sur la branche par défaut. `git` doit être installé : la récupération est un clone superficiel. | |
| 83 | + | |
| 84 | +Un projet qui a déjà un `.turbo-moonbit` est laissé tel quel — l'éditeur refuse plutôt que d'écraser ce que le projet a décidé. Déplacez d'abord le dossier si vous voulez le remplacer. | |
| 85 | + | |
| 73 | 86 | ## Variantes |
| 74 | 87 | |
| 75 | 88 | - **Vous lancez l'éditeur depuis un sous-dossier.** Les réglages ne sont pas trouvés : seul `./.turbo-moonbit` est consulté, sans remontée vers la racine du projet. Lancez depuis le dossier du projet, ou passez `-theme` pour cette fois. |
| @@ -70,6 +70,19 @@ turbo-moonbit -theme turbo-dark main.mbt | |||
| 70 | 70 | ||
| 71 | **Options ▸ Project settings…** le rouvre. L'entrée est grisée dans un projet qui n'en a pas. | 71 | **Options ▸ Project settings…** le rouvre. L'entrée est grisée dans un projet qui n'en a pas. |
| 72 | 72 | ||
| 73 | +## Partir d'une configuration partagée | ||
| 74 | + | ||
| 75 | +Une équipe peut garder des configurations toutes prêtes dans un dépôt — un dossier par sorte de projet, chacun avec un `.turbo-moonbit` dedans. Donnez à l'éditeur l'URL du dossier, telle que le navigateur l'affiche, et il copie ce `.turbo-moonbit` dans le répertoire courant : | ||
| 76 | + | ||
| 77 | +```bash | ||
| 78 | +cd mon-projet | ||
| 79 | +turbo-moonbit -load-config https://rickub.com/turbo-editors/configs/tree/main/golang-init | ||
| 80 | +``` | ||
| 81 | + | ||
| 82 | +Il affiche ce qui est arrivé et quitte ; le `turbo-moonbit` suivant ouvre le projet avec ces réglages, extraits et outils en vigueur. L'URL peut être sur rickub, GitHub, GitLab ou Codeberg, et pointer sur le dossier, sur le `.turbo-moonbit` qu'il contient, ou sur le dépôt lui-même pour sa racine sur la branche par défaut. `git` doit être installé : la récupération est un clone superficiel. | ||
| 83 | + | ||
| 84 | +Un projet qui a déjà un `.turbo-moonbit` est laissé tel quel — l'éditeur refuse plutôt que d'écraser ce que le projet a décidé. Déplacez d'abord le dossier si vous voulez le remplacer. | ||
| 85 | + | ||
| 73 | ## Variantes | 86 | ## Variantes |
| 74 | 87 | ||
| 75 | - **Vous lancez l'éditeur depuis un sous-dossier.** Les réglages ne sont pas trouvés : seul `./.turbo-moonbit` est consulté, sans remontée vers la racine du projet. Lancez depuis le dossier du projet, ou passez `-theme` pour cette fois. | 88 | - **Vous lancez l'éditeur depuis un sous-dossier.** Les réglages ne sont pas trouvés : seul `./.turbo-moonbit` est consulté, sans remontée vers la racine du projet. Lancez depuis le dossier du projet, ou passez `-theme` pour cette fois. |
modified
docs/fr/reference/cli.md +7 -0 | @@ -18,6 +18,7 @@ Chaque `fichier` est ouvert dans sa propre fenêtre. Un fichier qui n'existe pas | ||
| 18 | 18 | | `-list-themes` | booléen | `false` | Affiche chaque thème chargeable avec sa description, puis le répertoire de thèmes utilisateur, et quitte. | |
| 19 | 19 | | `-no-lsp` | booléen | `false` | Ne démarre pas de serveur de langage. La coloration et l'édition sont inchangées. | |
| 20 | 20 | | `-version` | booléen | `false` | Affiche `Turbo MoonBit <version>` sur une ligne, avec le commit et la date de build quand le build les a enregistrés, puis quitte. Voir [le numéro de version](versioning.md). | |
| 21 | +| `-load-config <url>` | chaîne | aucune | Copie le répertoire `.turbo-moonbit` trouvé à l'URL d'un dépôt — rickub, GitHub, GitLab ou Codeberg, l'URL du dossier telle que le navigateur l'affiche — dans le répertoire courant, affiche ce qui est arrivé, et quitte. Nécessite `git`. Refuse si `./.turbo-moonbit` existe déjà. L'éditeur n'est pas lancé. | | |
| 21 | 22 | | `-h`, `-help` | booléen | `false` | Affiche la liste des options et quitte. | |
| 22 | 23 | |
| 23 | 24 | ## Environnement |
| @@ -34,6 +35,7 @@ Chaque `fichier` est ouvert dans sa propre fenêtre. Un fichier qui n'existe pas | ||
| 34 | 35 | | --- | --- | |
| 35 | 36 | | `$TURBO_MOONBIT_THEME_DIR/*.toml` | Thèmes utilisateur, quand la variable est définie. | |
| 36 | 37 | | `./.turbo-moonbit/settings.toml` | Les réglages de ce projet, lus une fois au démarrage. Voir [réglages de projet](project-settings.md). | |
| 38 | +| `./.turbo-moonbit/` (écrit) | Créé par `-load-config` à partir de la copie d'un dépôt, quand le projet n'en a pas encore. | | |
| 37 | 39 | | `~/.config/turbo-moonbit/themes/*.toml` | Thèmes utilisateur sous Linux (`os.UserConfigDir`). | |
| 38 | 40 | | `~/Library/Application Support/turbo-moonbit/themes/*.toml` | Thèmes utilisateur sous macOS. | |
| 39 | 41 | | `<module>/moon.mod` | Trouvé en remontant depuis le premier fichier ; son répertoire devient la racine du serveur de langage. | |
| @@ -72,6 +74,7 @@ turbo-moonbit main.mbt moon.mod # deux fenêtres | ||
| 72 | 74 | turbo-moonbit -theme turbo-dark main.mbt # un autre thème |
| 73 | 75 | turbo-moonbit -no-lsp main.mbt # sans serveur de langage |
| 74 | 76 | turbo-moonbit -list-themes # quels thèmes existent |
| 77 | +turbo-moonbit -load-config https://rickub.com/turbo-editors/configs/tree/main/golang-init # partir d'une configuration partagée | |
| 75 | 78 | ``` |
| 76 | 79 | |
| 77 | 80 | ## Installateur |
| @@ -98,3 +101,7 @@ turbo-moonbit -list-themes # quels thèmes existent | ||
| 98 | 101 | | `turbo-moonbit: initialising the terminal: …` | Le terminal a été ouvert mais n'a pas pu être mis en mode brut. | |
| 99 | 102 | | `Cannot open` (dans une boîte) | Le chemin est un répertoire, ou n'est pas lisible. | |
| 100 | 103 | | `Cannot save` (dans une boîte) | Le répertoire n'existe pas, ou n'est pas accessible en écriture. | |
| 104 | +| `turbo-moonbit: configrepo: the project already has a configuration directory: …` | `-load-config` dans un projet qui a déjà `.turbo-moonbit`. Déplacez-le d'abord. | | |
| 105 | +| `turbo-moonbit: configrepo: git is not installed` | `-load-config` a besoin de la commande `git` dans le `PATH`. | | |
| 106 | +| `turbo-moonbit: configrepo: no configuration directory at that path: …` | Le dépôt existe mais ne contient pas de `.turbo-moonbit` là où l'URL pointe. | | |
| 107 | +| `turbo-moonbit: configrepo: no repository answered: …` | Aucune adresse de clone pour cette URL n'a répondu : l'URL, le réseau, ou un dépôt privé. | | |
| @@ -18,6 +18,7 @@ Chaque `fichier` est ouvert dans sa propre fenêtre. Un fichier qui n'existe pas | |||
| 18 | | `-list-themes` | booléen | `false` | Affiche chaque thème chargeable avec sa description, puis le répertoire de thèmes utilisateur, et quitte. | | 18 | | `-list-themes` | booléen | `false` | Affiche chaque thème chargeable avec sa description, puis le répertoire de thèmes utilisateur, et quitte. | |
| 19 | | `-no-lsp` | booléen | `false` | Ne démarre pas de serveur de langage. La coloration et l'édition sont inchangées. | | 19 | | `-no-lsp` | booléen | `false` | Ne démarre pas de serveur de langage. La coloration et l'édition sont inchangées. | |
| 20 | | `-version` | booléen | `false` | Affiche `Turbo MoonBit <version>` sur une ligne, avec le commit et la date de build quand le build les a enregistrés, puis quitte. Voir [le numéro de version](versioning.md). | | 20 | | `-version` | booléen | `false` | Affiche `Turbo MoonBit <version>` sur une ligne, avec le commit et la date de build quand le build les a enregistrés, puis quitte. Voir [le numéro de version](versioning.md). | |
| 21 | +| `-load-config <url>` | chaîne | aucune | Copie le répertoire `.turbo-moonbit` trouvé à l'URL d'un dépôt — rickub, GitHub, GitLab ou Codeberg, l'URL du dossier telle que le navigateur l'affiche — dans le répertoire courant, affiche ce qui est arrivé, et quitte. Nécessite `git`. Refuse si `./.turbo-moonbit` existe déjà. L'éditeur n'est pas lancé. | | ||
| 21 | | `-h`, `-help` | booléen | `false` | Affiche la liste des options et quitte. | | 22 | | `-h`, `-help` | booléen | `false` | Affiche la liste des options et quitte. | |
| 22 | 23 | ||
| 23 | ## Environnement | 24 | ## Environnement |
| @@ -34,6 +35,7 @@ Chaque `fichier` est ouvert dans sa propre fenêtre. Un fichier qui n'existe pas | |||
| 34 | | --- | --- | | 35 | | --- | --- | |
| 35 | | `$TURBO_MOONBIT_THEME_DIR/*.toml` | Thèmes utilisateur, quand la variable est définie. | | 36 | | `$TURBO_MOONBIT_THEME_DIR/*.toml` | Thèmes utilisateur, quand la variable est définie. | |
| 36 | | `./.turbo-moonbit/settings.toml` | Les réglages de ce projet, lus une fois au démarrage. Voir [réglages de projet](project-settings.md). | | 37 | | `./.turbo-moonbit/settings.toml` | Les réglages de ce projet, lus une fois au démarrage. Voir [réglages de projet](project-settings.md). | |
| 38 | +| `./.turbo-moonbit/` (écrit) | Créé par `-load-config` à partir de la copie d'un dépôt, quand le projet n'en a pas encore. | | ||
| 37 | | `~/.config/turbo-moonbit/themes/*.toml` | Thèmes utilisateur sous Linux (`os.UserConfigDir`). | | 39 | | `~/.config/turbo-moonbit/themes/*.toml` | Thèmes utilisateur sous Linux (`os.UserConfigDir`). | |
| 38 | | `~/Library/Application Support/turbo-moonbit/themes/*.toml` | Thèmes utilisateur sous macOS. | | 40 | | `~/Library/Application Support/turbo-moonbit/themes/*.toml` | Thèmes utilisateur sous macOS. | |
| 39 | | `<module>/moon.mod` | Trouvé en remontant depuis le premier fichier ; son répertoire devient la racine du serveur de langage. | | 41 | | `<module>/moon.mod` | Trouvé en remontant depuis le premier fichier ; son répertoire devient la racine du serveur de langage. | |
| @@ -72,6 +74,7 @@ turbo-moonbit main.mbt moon.mod # deux fenêtres | |||
| 72 | turbo-moonbit -theme turbo-dark main.mbt # un autre thème | 74 | turbo-moonbit -theme turbo-dark main.mbt # un autre thème |
| 73 | turbo-moonbit -no-lsp main.mbt # sans serveur de langage | 75 | turbo-moonbit -no-lsp main.mbt # sans serveur de langage |
| 74 | turbo-moonbit -list-themes # quels thèmes existent | 76 | turbo-moonbit -list-themes # quels thèmes existent |
| 77 | +turbo-moonbit -load-config https://rickub.com/turbo-editors/configs/tree/main/golang-init # partir d'une configuration partagée | ||
| 75 | ``` | 78 | ``` |
| 76 | 79 | ||
| 77 | ## Installateur | 80 | ## Installateur |
| @@ -98,3 +101,7 @@ turbo-moonbit -list-themes # quels thèmes existent | |||
| 98 | | `turbo-moonbit: initialising the terminal: …` | Le terminal a été ouvert mais n'a pas pu être mis en mode brut. | | 101 | | `turbo-moonbit: initialising the terminal: …` | Le terminal a été ouvert mais n'a pas pu être mis en mode brut. | |
| 99 | | `Cannot open` (dans une boîte) | Le chemin est un répertoire, ou n'est pas lisible. | | 102 | | `Cannot open` (dans une boîte) | Le chemin est un répertoire, ou n'est pas lisible. | |
| 100 | | `Cannot save` (dans une boîte) | Le répertoire n'existe pas, ou n'est pas accessible en écriture. | | 103 | | `Cannot save` (dans une boîte) | Le répertoire n'existe pas, ou n'est pas accessible en écriture. | |
| 104 | +| `turbo-moonbit: configrepo: the project already has a configuration directory: …` | `-load-config` dans un projet qui a déjà `.turbo-moonbit`. Déplacez-le d'abord. | | ||
| 105 | +| `turbo-moonbit: configrepo: git is not installed` | `-load-config` a besoin de la commande `git` dans le `PATH`. | | ||
| 106 | +| `turbo-moonbit: configrepo: no configuration directory at that path: …` | Le dépôt existe mais ne contient pas de `.turbo-moonbit` là où l'URL pointe. | | ||
| 107 | +| `turbo-moonbit: configrepo: no repository answered: …` | Aucune adresse de clone pour cette URL n'a répondu : l'URL, le réseau, ou un dépôt privé. | | ||
modified
go.mod +1 -1 | @@ -4,7 +4,7 @@ go 1.26.1 | ||
| 4 | 4 | |
| 5 | 5 | require ( |
| 6 | 6 | github.com/gdamore/tcell/v2 v2.13.10 |
| 7 | - rickub.com/turbo-editors/turbo-core v1.0.2 | |
| 7 | + rickub.com/turbo-editors/turbo-core v1.0.3 | |
| 8 | 8 | ) |
| 9 | 9 | |
| 10 | 10 | require ( |
| @@ -4,7 +4,7 @@ go 1.26.1 | |||
| 4 | 4 | ||
| 5 | require ( | 5 | require ( |
| 6 | github.com/gdamore/tcell/v2 v2.13.10 | 6 | github.com/gdamore/tcell/v2 v2.13.10 |
| 7 | - rickub.com/turbo-editors/turbo-core v1.0.2 | 7 | + rickub.com/turbo-editors/turbo-core v1.0.3 |
| 8 | ) | 8 | ) |
| 9 | 9 | ||
| 10 | require ( | 10 | require ( |
modified
go.sum +2 -2 | @@ -45,5 +45,5 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn | ||
| 45 | 45 | golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= |
| 46 | 46 | golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= |
| 47 | 47 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= |
| 48 | -rickub.com/turbo-editors/turbo-core v1.0.2 h1:OA/LhR6JkvtUlp6lTgYa0wwaWou3HKXd1Glnoscyffw= | |
| 49 | -rickub.com/turbo-editors/turbo-core v1.0.2/go.mod h1:rmfIY5gsFEo3sC5IIJFapwsGvdKG6NjrD7ACmnNTKq8= | |
| 48 | +rickub.com/turbo-editors/turbo-core v1.0.3 h1:j+bqzIIBsese8iLgre9PQdbpi9YkoOMIHP6pOli5UjE= | |
| 49 | +rickub.com/turbo-editors/turbo-core v1.0.3/go.mod h1:rmfIY5gsFEo3sC5IIJFapwsGvdKG6NjrD7ACmnNTKq8= | |
| @@ -45,5 +45,5 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn | |||
| 45 | golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= | 45 | golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= |
| 46 | golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= | 46 | golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= |
| 47 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | 47 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= |
| 48 | -rickub.com/turbo-editors/turbo-core v1.0.2 h1:OA/LhR6JkvtUlp6lTgYa0wwaWou3HKXd1Glnoscyffw= | 48 | +rickub.com/turbo-editors/turbo-core v1.0.3 h1:j+bqzIIBsese8iLgre9PQdbpi9YkoOMIHP6pOli5UjE= |
| 49 | -rickub.com/turbo-editors/turbo-core v1.0.2/go.mod h1:rmfIY5gsFEo3sC5IIJFapwsGvdKG6NjrD7ACmnNTKq8= | 49 | +rickub.com/turbo-editors/turbo-core v1.0.3/go.mod h1:rmfIY5gsFEo3sC5IIJFapwsGvdKG6NjrD7ACmnNTKq8= |
modified
main.go +38 -0 | @@ -16,6 +16,7 @@ | ||
| 16 | 16 | // -list-themes print the available themes and exit |
| 17 | 17 | // -no-lsp do not start a language server |
| 18 | 18 | // -version print the version and exit |
| 19 | +// -load-config url copy the .turbo-moonbit directory found at a repository URL into the working directory and exit | |
| 19 | 20 | package main |
| 20 | 21 | |
| 21 | 22 | import ( |
| @@ -24,10 +25,12 @@ import ( | ||
| 24 | 25 | "flag" |
| 25 | 26 | "fmt" |
| 26 | 27 | "os" |
| 28 | + "strings" | |
| 27 | 29 | |
| 28 | 30 | "github.com/gdamore/tcell/v2" |
| 29 | 31 | |
| 30 | 32 | "rickub.com/turbo-editors/turbo-core/app" |
| 33 | + "rickub.com/turbo-editors/turbo-core/configrepo" | |
| 31 | 34 | "rickub.com/turbo-editors/turbo-core/profile" |
| 32 | 35 | "rickub.com/turbo-editors/turbo-core/settings" |
| 33 | 36 | "rickub.com/turbo-editors/turbo-core/theme" |
| @@ -47,6 +50,7 @@ func main() { | ||
| 47 | 50 | type options struct { |
| 48 | 51 | theme string |
| 49 | 52 | listThemes bool |
| 53 | + loadConfig string | |
| 50 | 54 | noLSP bool |
| 51 | 55 | version bool |
| 52 | 56 | files []string |
| @@ -63,6 +67,7 @@ func parseFlags() options { | ||
| 63 | 67 | flag.BoolVar(&opts.listThemes, "list-themes", false, "print the available themes and exit") |
| 64 | 68 | flag.BoolVar(&opts.noLSP, "no-lsp", false, "do not start a language server") |
| 65 | 69 | flag.BoolVar(&opts.version, "version", false, "print the version and exit") |
| 70 | + flag.StringVar(&opts.loadConfig, "load-config", "", "copy the .turbo-moonbit directory found at this repository URL into the working directory, then exit") | |
| 66 | 71 | flag.Parse() |
| 67 | 72 | |
| 68 | 73 | opts.files = flag.Args() |
| @@ -83,6 +88,8 @@ func run() error { | ||
| 83 | 88 | return nil |
| 84 | 89 | case opts.listThemes: |
| 85 | 90 | return listThemes(p) |
| 91 | + case opts.loadConfig != "": | |
| 92 | + return loadConfig(p, opts.loadConfig) | |
| 86 | 93 | } |
| 87 | 94 | |
| 88 | 95 | return edit(opts, p) |
| @@ -107,6 +114,37 @@ func listThemes(p profile.Profile) error { | ||
| 107 | 114 | return nil |
| 108 | 115 | } |
| 109 | 116 | |
| 117 | +// loadConfig copies a shared configuration — the .turbo-moonbit directory at a | |
| 118 | +// repository URL, on rickub, GitHub, GitLab or Codeberg — into the working | |
| 119 | +// directory, and says what arrived. The editor is not started: this is a | |
| 120 | +// set-up step, and the next command is the one that opens the project. | |
| 121 | +// | |
| 122 | +// A project that already has a .turbo-moonbit is left alone; turbo-core refuses | |
| 123 | +// rather than overwrite what the project decided. | |
| 124 | +func loadConfig(p profile.Profile, url string) error { | |
| 125 | + result, err := configrepo.Load(context.Background(), p, url, ".") | |
| 126 | + if err != nil { | |
| 127 | + return err | |
| 128 | + } | |
| 129 | + fmt.Print(describeLoad(result)) | |
| 130 | + return nil | |
| 131 | +} | |
| 132 | + | |
| 133 | +// describeLoad is what a successful -load-config prints: where the files | |
| 134 | +// came from, and each of them, so the reader knows what is now in force. | |
| 135 | +func describeLoad(result configrepo.Result) string { | |
| 136 | + var out strings.Builder | |
| 137 | + fmt.Fprintf(&out, "Copied %s from %s", result.Dir, result.Remote) | |
| 138 | + if result.Ref != "" { | |
| 139 | + fmt.Fprintf(&out, " (%s)", result.Ref) | |
| 140 | + } | |
| 141 | + out.WriteString(":\n") | |
| 142 | + for _, file := range result.Files { | |
| 143 | + fmt.Fprintf(&out, " %s\n", file) | |
| 144 | + } | |
| 145 | + return out.String() | |
| 146 | +} | |
| 147 | + | |
| 110 | 148 | // edit opens the terminal and runs the editor until the user leaves. |
| 111 | 149 | func edit(opts options, p profile.Profile) error { |
| 112 | 150 | project, projectSettings := loadProjectSettings(p) |
| @@ -16,6 +16,7 @@ | |||
| 16 | // -list-themes print the available themes and exit | 16 | // -list-themes print the available themes and exit |
| 17 | // -no-lsp do not start a language server | 17 | // -no-lsp do not start a language server |
| 18 | // -version print the version and exit | 18 | // -version print the version and exit |
| 19 | +// -load-config url copy the .turbo-moonbit directory found at a repository URL into the working directory and exit | ||
| 19 | package main | 20 | package main |
| 20 | 21 | ||
| 21 | import ( | 22 | import ( |
| @@ -24,10 +25,12 @@ import ( | |||
| 24 | "flag" | 25 | "flag" |
| 25 | "fmt" | 26 | "fmt" |
| 26 | "os" | 27 | "os" |
| 28 | + "strings" | ||
| 27 | 29 | ||
| 28 | "github.com/gdamore/tcell/v2" | 30 | "github.com/gdamore/tcell/v2" |
| 29 | 31 | ||
| 30 | "rickub.com/turbo-editors/turbo-core/app" | 32 | "rickub.com/turbo-editors/turbo-core/app" |
| 33 | + "rickub.com/turbo-editors/turbo-core/configrepo" | ||
| 31 | "rickub.com/turbo-editors/turbo-core/profile" | 34 | "rickub.com/turbo-editors/turbo-core/profile" |
| 32 | "rickub.com/turbo-editors/turbo-core/settings" | 35 | "rickub.com/turbo-editors/turbo-core/settings" |
| 33 | "rickub.com/turbo-editors/turbo-core/theme" | 36 | "rickub.com/turbo-editors/turbo-core/theme" |
| @@ -47,6 +50,7 @@ func main() { | |||
| 47 | type options struct { | 50 | type options struct { |
| 48 | theme string | 51 | theme string |
| 49 | listThemes bool | 52 | listThemes bool |
| 53 | + loadConfig string | ||
| 50 | noLSP bool | 54 | noLSP bool |
| 51 | version bool | 55 | version bool |
| 52 | files []string | 56 | files []string |
| @@ -63,6 +67,7 @@ func parseFlags() options { | |||
| 63 | flag.BoolVar(&opts.listThemes, "list-themes", false, "print the available themes and exit") | 67 | flag.BoolVar(&opts.listThemes, "list-themes", false, "print the available themes and exit") |
| 64 | flag.BoolVar(&opts.noLSP, "no-lsp", false, "do not start a language server") | 68 | flag.BoolVar(&opts.noLSP, "no-lsp", false, "do not start a language server") |
| 65 | flag.BoolVar(&opts.version, "version", false, "print the version and exit") | 69 | flag.BoolVar(&opts.version, "version", false, "print the version and exit") |
| 70 | + flag.StringVar(&opts.loadConfig, "load-config", "", "copy the .turbo-moonbit directory found at this repository URL into the working directory, then exit") | ||
| 66 | flag.Parse() | 71 | flag.Parse() |
| 67 | 72 | ||
| 68 | opts.files = flag.Args() | 73 | opts.files = flag.Args() |
| @@ -83,6 +88,8 @@ func run() error { | |||
| 83 | return nil | 88 | return nil |
| 84 | case opts.listThemes: | 89 | case opts.listThemes: |
| 85 | return listThemes(p) | 90 | return listThemes(p) |
| 91 | + case opts.loadConfig != "": | ||
| 92 | + return loadConfig(p, opts.loadConfig) | ||
| 86 | } | 93 | } |
| 87 | 94 | ||
| 88 | return edit(opts, p) | 95 | return edit(opts, p) |
| @@ -107,6 +114,37 @@ func listThemes(p profile.Profile) error { | |||
| 107 | return nil | 114 | return nil |
| 108 | } | 115 | } |
| 109 | 116 | ||
| 117 | +// loadConfig copies a shared configuration — the .turbo-moonbit directory at a | ||
| 118 | +// repository URL, on rickub, GitHub, GitLab or Codeberg — into the working | ||
| 119 | +// directory, and says what arrived. The editor is not started: this is a | ||
| 120 | +// set-up step, and the next command is the one that opens the project. | ||
| 121 | +// | ||
| 122 | +// A project that already has a .turbo-moonbit is left alone; turbo-core refuses | ||
| 123 | +// rather than overwrite what the project decided. | ||
| 124 | +func loadConfig(p profile.Profile, url string) error { | ||
| 125 | + result, err := configrepo.Load(context.Background(), p, url, ".") | ||
| 126 | + if err != nil { | ||
| 127 | + return err | ||
| 128 | + } | ||
| 129 | + fmt.Print(describeLoad(result)) | ||
| 130 | + return nil | ||
| 131 | +} | ||
| 132 | + | ||
| 133 | +// describeLoad is what a successful -load-config prints: where the files | ||
| 134 | +// came from, and each of them, so the reader knows what is now in force. | ||
| 135 | +func describeLoad(result configrepo.Result) string { | ||
| 136 | + var out strings.Builder | ||
| 137 | + fmt.Fprintf(&out, "Copied %s from %s", result.Dir, result.Remote) | ||
| 138 | + if result.Ref != "" { | ||
| 139 | + fmt.Fprintf(&out, " (%s)", result.Ref) | ||
| 140 | + } | ||
| 141 | + out.WriteString(":\n") | ||
| 142 | + for _, file := range result.Files { | ||
| 143 | + fmt.Fprintf(&out, " %s\n", file) | ||
| 144 | + } | ||
| 145 | + return out.String() | ||
| 146 | +} | ||
| 147 | + | ||
| 110 | // edit opens the terminal and runs the editor until the user leaves. | 148 | // edit opens the terminal and runs the editor until the user leaves. |
| 111 | func edit(opts options, p profile.Profile) error { | 149 | func edit(opts options, p profile.Profile) error { |
| 112 | project, projectSettings := loadProjectSettings(p) | 150 | project, projectSettings := loadProjectSettings(p) |
modified
main_test.go +41 -0 | @@ -1,13 +1,16 @@ | ||
| 1 | 1 | package main |
| 2 | 2 | |
| 3 | 3 | import ( |
| 4 | + "errors" | |
| 4 | 5 | "flag" |
| 5 | 6 | "os" |
| 6 | 7 | "path/filepath" |
| 7 | 8 | "slices" |
| 9 | + "strings" | |
| 8 | 10 | "testing" |
| 9 | 11 | |
| 10 | 12 | "rickub.com/turbo-editors/turbo-core/app" |
| 13 | + "rickub.com/turbo-editors/turbo-core/configrepo" | |
| 11 | 14 | "rickub.com/turbo-editors/turbo-core/settings" |
| 12 | 15 | |
| 13 | 16 | "rickub.com/turbo-editors/turbo-moonbit/internal/moonbitlang" |
| @@ -155,3 +158,41 @@ func TestABrokenSettingsFileDoesNotStopTheEditorOpening(t *testing.T) { | ||
| 155 | 158 | t.Errorf("loadProjectSettings() = %+v with a broken file, want the defaults", loaded) |
| 156 | 159 | } |
| 157 | 160 | } |
| 161 | + | |
| 162 | +func TestDescribeLoadNamesTheSourceAndEveryFile(t *testing.T) { | |
| 163 | + got := describeLoad(configrepo.Result{ | |
| 164 | + Remote: "https://git.rickub.com/turbo-editors/configs.git", | |
| 165 | + Ref: "main", | |
| 166 | + Dir: "/work/.turbo-moonbit", | |
| 167 | + Files: []string{"settings.toml", "tools.toml"}, | |
| 168 | + }) | |
| 169 | + | |
| 170 | + want := "Copied /work/.turbo-moonbit from https://git.rickub.com/turbo-editors/configs.git (main):\n settings.toml\n tools.toml\n" | |
| 171 | + if got != want { | |
| 172 | + t.Errorf("describeLoad() =\n%q\nwant\n%q", got, want) | |
| 173 | + } | |
| 174 | +} | |
| 175 | + | |
| 176 | +func TestDescribeLoadOmitsTheRefWhenTheDefaultBranchWasUsed(t *testing.T) { | |
| 177 | + got := describeLoad(configrepo.Result{Remote: "r", Dir: "d"}) | |
| 178 | + | |
| 179 | + if strings.Contains(got, "(") { | |
| 180 | + t.Errorf("describeLoad() = %q, want no parenthesised ref", got) | |
| 181 | + } | |
| 182 | +} | |
| 183 | + | |
| 184 | +func TestLoadConfigLeavesAProjectThatHasAConfigurationAlone(t *testing.T) { | |
| 185 | + // Checked before anything is fetched, so this needs neither git nor a | |
| 186 | + // network: the project's own .turbo-moonbit is a decision, not a default. | |
| 187 | + project := t.TempDir() | |
| 188 | + if err := os.MkdirAll(filepath.Join(project, ".turbo-moonbit"), 0o755); err != nil { | |
| 189 | + t.Fatal(err) | |
| 190 | + } | |
| 191 | + t.Chdir(project) | |
| 192 | + | |
| 193 | + err := loadConfig(moonbitlang.Profile(), "https://rickub.com/turbo-editors/configs/tree/main/golang-init") | |
| 194 | + | |
| 195 | + if !errors.Is(err, configrepo.ErrExists) { | |
| 196 | + t.Errorf("loadConfig() error = %v, want ErrExists", err) | |
| 197 | + } | |
| 198 | +} | |
| @@ -1,13 +1,16 @@ | |||
| 1 | package main | 1 | package main |
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | + "errors" | ||
| 4 | "flag" | 5 | "flag" |
| 5 | "os" | 6 | "os" |
| 6 | "path/filepath" | 7 | "path/filepath" |
| 7 | "slices" | 8 | "slices" |
| 9 | + "strings" | ||
| 8 | "testing" | 10 | "testing" |
| 9 | 11 | ||
| 10 | "rickub.com/turbo-editors/turbo-core/app" | 12 | "rickub.com/turbo-editors/turbo-core/app" |
| 13 | + "rickub.com/turbo-editors/turbo-core/configrepo" | ||
| 11 | "rickub.com/turbo-editors/turbo-core/settings" | 14 | "rickub.com/turbo-editors/turbo-core/settings" |
| 12 | 15 | ||
| 13 | "rickub.com/turbo-editors/turbo-moonbit/internal/moonbitlang" | 16 | "rickub.com/turbo-editors/turbo-moonbit/internal/moonbitlang" |
| @@ -155,3 +158,41 @@ func TestABrokenSettingsFileDoesNotStopTheEditorOpening(t *testing.T) { | |||
| 155 | t.Errorf("loadProjectSettings() = %+v with a broken file, want the defaults", loaded) | 158 | t.Errorf("loadProjectSettings() = %+v with a broken file, want the defaults", loaded) |
| 156 | } | 159 | } |
| 157 | } | 160 | } |
| 161 | + | ||
| 162 | +func TestDescribeLoadNamesTheSourceAndEveryFile(t *testing.T) { | ||
| 163 | + got := describeLoad(configrepo.Result{ | ||
| 164 | + Remote: "https://git.rickub.com/turbo-editors/configs.git", | ||
| 165 | + Ref: "main", | ||
| 166 | + Dir: "/work/.turbo-moonbit", | ||
| 167 | + Files: []string{"settings.toml", "tools.toml"}, | ||
| 168 | + }) | ||
| 169 | + | ||
| 170 | + want := "Copied /work/.turbo-moonbit from https://git.rickub.com/turbo-editors/configs.git (main):\n settings.toml\n tools.toml\n" | ||
| 171 | + if got != want { | ||
| 172 | + t.Errorf("describeLoad() =\n%q\nwant\n%q", got, want) | ||
| 173 | + } | ||
| 174 | +} | ||
| 175 | + | ||
| 176 | +func TestDescribeLoadOmitsTheRefWhenTheDefaultBranchWasUsed(t *testing.T) { | ||
| 177 | + got := describeLoad(configrepo.Result{Remote: "r", Dir: "d"}) | ||
| 178 | + | ||
| 179 | + if strings.Contains(got, "(") { | ||
| 180 | + t.Errorf("describeLoad() = %q, want no parenthesised ref", got) | ||
| 181 | + } | ||
| 182 | +} | ||
| 183 | + | ||
| 184 | +func TestLoadConfigLeavesAProjectThatHasAConfigurationAlone(t *testing.T) { | ||
| 185 | + // Checked before anything is fetched, so this needs neither git nor a | ||
| 186 | + // network: the project's own .turbo-moonbit is a decision, not a default. | ||
| 187 | + project := t.TempDir() | ||
| 188 | + if err := os.MkdirAll(filepath.Join(project, ".turbo-moonbit"), 0o755); err != nil { | ||
| 189 | + t.Fatal(err) | ||
| 190 | + } | ||
| 191 | + t.Chdir(project) | ||
| 192 | + | ||
| 193 | + err := loadConfig(moonbitlang.Profile(), "https://rickub.com/turbo-editors/configs/tree/main/golang-init") | ||
| 194 | + | ||
| 195 | + if !errors.Is(err, configrepo.ErrExists) { | ||
| 196 | + t.Errorf("loadConfig() error = %v, want ErrExists", err) | ||
| 197 | + } | ||
| 198 | +} | ||