| 📦 Turbo Go 3d7798b k33g 12h ago | 1 | # Reference: command line |
| 2 | |
| 3 | > Neutral description of the `turbo-go` command, its flags, and the environment it reads. |
| 4 | |
| 5 | ## Synopsis |
| 6 | |
| 7 | ``` |
| 8 | turbo-go [flags] [file...] |
| 9 | ``` |
| 10 | |
| 11 | Each `file` is opened in its own window. A file that does not exist yet is opened as an empty buffer bound to that path. With no file at all, one empty untitled window is opened. |
| 12 | |
| 13 | ## Flags |
| 14 | |
| 15 | | Flag | Type | Default | Description | |
| 16 | | --- | --- | --- | --- | |
| 17 | | `-theme <name>` | string | the project's, else `turbo-classic` | Theme to start with, overriding the project's own. An unknown name falls back to the default without an error. | |
| 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. | |
| 20 | | `-version` | bool | `false` | Print `Turbo Go <version>` on one line, with the commit and build date when the build recorded them, and exit. See [the version number](versioning.md). | |
| 21 | | `-h`, `-help` | bool | `false` | Print the flag list and exit. | |
| 22 | |
| 23 | ## Environment |
| 24 | |
| 25 | | Variable | Read by | Effect | |
| 26 | | --- | --- | --- | |
| 27 | | `TURBO_GO_THEME_DIR` | theme loading | Directory to read user themes from, instead of the platform configuration directory. | |
| 28 | | `TERM` | tcell | Which terminal description to use. | |
| 29 | | `GOBIN`, `GOPATH`, `HOME` | gopls lookup | Searched, in that order, when `gopls` is not on `PATH`. | |
| 30 | |
| 31 | ## Files |
| 32 | |
| 33 | | Path | Purpose | |
| 34 | | --- | --- | |
| 35 | | `$TURBO_GO_THEME_DIR/*.toml` | User themes, when the variable is set. | |
| 36 | | `./.turbo-go/settings.toml` | This project's settings, read once at start-up. See [project settings](project-settings.md). | |
| 37 | | `~/.config/turbo-go/themes/*.toml` | User themes on Linux (`os.UserConfigDir`). | |
| 38 | | `~/Library/Application Support/turbo-go/themes/*.toml` | User themes on macOS. | |
| 39 | | `<module>/go.mod` | Located by walking up from the first file; its directory becomes the language server's root. | |
| 40 | |
| 41 | ## Exit status |
| 42 | |
| 43 | | Status | Meaning | |
| 44 | | --- | --- | |
| 45 | | `0` | The editor exited normally, or an informational flag was used. | |
| 46 | | `1` | The terminal could not be opened or initialised. The reason is printed to standard error. | |
| 47 | |
| 48 | ## Make targets |
| 49 | |
| 50 | Run from a checkout. |
| 51 | |
| 52 | | Target | What it runs | |
| 53 | | --- | --- | |
| 54 | | `make help` | List the targets. This is the default. | |
| 55 | | `make test` | `go test ./...` | |
| 56 | | `make test-verbose` | `go test -v ./...` | |
| 57 | | `make cover` | `go test -cover ./...` | |
| 58 | | `make build` | `go build -o bin/turbo-go .` | |
| 59 | | `make install` | `scripts/install.sh` — build and install onto your PATH | |
| 60 | | `make uninstall` | `scripts/install.sh --uninstall` | |
| 61 | | `make run FILE=x.go` | `make build`, then `./bin/turbo-go x.go` | |
| 62 | | `make fmt` | `go fmt ./...` | |
| 63 | | `make vet` | `go vet ./...` | |
| 64 | | `make check` | `fmt`, then `vet`, then `test` | |
| 65 | | `make clean` | Remove `bin/` | |
| 66 | |
| 67 | ## Examples |
| 68 | |
| 69 | ```bash |
| 70 | turbo-go # one empty window |
| 71 | turbo-go main.go go.mod # two windows |
| 72 | turbo-go -theme turbo-dark main.go # a different theme |
| 73 | turbo-go -no-lsp main.go # no language server |
| 74 | turbo-go -list-themes # what themes exist |
| 75 | ``` |
| 76 | |
| 77 | ## Installer |
| 78 | |
| 79 | `scripts/install.sh`, also reachable as `make install`. |
| 80 | |
| 81 | | Option | Description | |
| 82 | | --- | --- | |
| 83 | | `-p`, `--prefix DIR` | Install into `DIR` instead of `$GOBIN` or `$GOPATH/bin`. | |
| 84 | | `--with-gopls` | Install `gopls` as well, if it is not already there. | |
| 85 | | `--uninstall` | Remove an installed `turbo-go` and stop. | |
| 86 | | `-h`, `--help` | Print the options and stop. | |
| 87 | |
| 88 | | Exit status | Meaning | |
| 89 | | --- | --- | |
| 90 | | `0` | Installed, removed, or help printed. | |
| 91 | | `1` | Go missing or too old, the build failed, or the destination could not be written. Nothing is installed and an existing installation is left untouched. | |
| 92 | |
| 93 | ## Errors |
| 94 | |
| 95 | | Message | Cause | |
| 96 | | --- | --- | |
| 97 | | `turbo-go: opening the terminal: …` | tcell could not open the terminal; usually `TERM` is unset or unknown. | |
| 98 | | `turbo-go: 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. | |
| 100 | | `Cannot save` (in a dialog) | The directory does not exist, or is not writable. | |