mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-10 04:54:03 -08:00
111 lines
3.2 KiB
Plaintext
111 lines
3.2 KiB
Plaintext
---
|
|
id: started
|
|
title: Get Started
|
|
sidebar_label: Get Started
|
|
---
|
|
|
|
## Install dependencies
|
|
|
|
### go
|
|
|
|
The codebase is in [go][go], meaning we need a working go setup before we can do anything else.
|
|
Have a look at the [go guide][go-started] to get up and running with go in no time!
|
|
|
|
:::caution
|
|
Oh My Posh needs at least go 1.18.
|
|
:::
|
|
|
|
### golangci-lint
|
|
|
|
To make sure we keep on writing quality code, [golang-ci lint][golang-ci-lint] is used to validate the changes.
|
|
Have a look at the [local installation guide][golang-ci-lint-local] to make sure you can validate this yourself as well.
|
|
|
|
## Get the source code
|
|
|
|
The source is hosted on [Github][omp]. When you want to contribute, create a [fork][gh-fork] so you can make changes in
|
|
your repository and create a pull request in the official Oh My Posh repository.
|
|
|
|
Clone your fork of Oh My Posh locally, replace `<user>` with your Github username.
|
|
|
|
```bash
|
|
git clone git@github.com:<user>/oh-my-posh.git
|
|
```
|
|
|
|
## Running tests
|
|
|
|
The go source code can be found in the `src/` directory, make sure to change to that one before continuing.
|
|
|
|
### Unit tests
|
|
|
|
```bash
|
|
go test -v ./...
|
|
```
|
|
|
|
### golangci-lint
|
|
|
|
```bash
|
|
golangci-lint run
|
|
```
|
|
|
|
## Building the app
|
|
|
|
The easiest way to validate your changes is to write tests. Unfortunately, as it's a visual tool, you'll want to validate
|
|
the changes by running the prompt in your shell as well. You can make use of go's `bin` folder which is usually added to
|
|
your path to add your own Oh My Posh binary to and immediately see the changes appear in your shell.
|
|
|
|
```bash
|
|
go build -o $GOPATH/bin/oh-my-posh
|
|
```
|
|
|
|
## Get an editor
|
|
|
|
A default config(.vscode folder) for [Visual Studio Code][code] is available in the repo:
|
|
|
|
- golangci-lint is configured as the default linter.
|
|
- Recommended extensions available for a smooth bootstrap.
|
|
|
|
![recommended extensions](/img/recommended_extensions.png "Recommended extensions" )
|
|
- Default run and debug configurations available.
|
|
|
|
Once the extensions are installed:
|
|
|
|
- Debug can be started by hitting F5.
|
|
- All tests can be run using the Test explorer.
|
|
|
|
### Extra tips
|
|
|
|
#### Configure Delve in VS Code
|
|
|
|
[Delve][delve] config is restrictive by default(string limit especially). You can expand some limits in VS Code(`settings.json` or directly in `launch.json`):
|
|
```
|
|
"go.delveConfig": {
|
|
|
|
"dlvLoadConfig": {
|
|
"followPointers": true,
|
|
"maxVariableRecurse": 3,
|
|
"maxStringLen": 400,
|
|
"maxArrayValues": 400,
|
|
"maxStructFields": -1
|
|
},
|
|
"apiVersion": 2,
|
|
"showGlobalVariables": false
|
|
}
|
|
```
|
|
|
|
## Up Next
|
|
|
|
With everything set up, you're ready to start making changes and create your first [PR][gh-pr]!
|
|
|
|
[go]: https://golang.org
|
|
[go-started]: https://golang.org/doc/install
|
|
[golang-ci-lint]: https://golangci-lint.run
|
|
[golang-ci-lint-local]: https://golangci-lint.run/usage/install/#local-installation
|
|
[go-bindata]: https://github.com/kevinburke/go-bindata/
|
|
[go-global]: https://github.com/golang/go/issues/40276
|
|
[pr-go-mod]: https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/.github/workflows/gomod.yml
|
|
[gh-pr]: https://github.com/JanDeDobbeleer/oh-my-posh/pulls
|
|
[omp]: https://github.com/JanDeDobbeleer/oh-my-posh
|
|
[gh-fork]: https://guides.github.com/activities/forking/
|
|
[code]: https://code.visualstudio.com
|
|
[delve]: https://github.com/go-delve/delve
|