mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
chore: add get started contributing guide
This commit is contained in:
parent
3993522019
commit
e27b21bf23
110
docs/docs/contributing-started.mdx
Normal file
110
docs/docs/contributing-started.mdx
Normal file
|
@ -0,0 +1,110 @@
|
|||
---
|
||||
id: contributing_started
|
||||
title: Get Started
|
||||
sidebar_label: Get Started
|
||||
---
|
||||
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
|
||||
## Getting started
|
||||
|
||||
### go
|
||||
|
||||
The code base 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!
|
||||
|
||||
### 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.
|
||||
|
||||
### go-bindata
|
||||
|
||||
Oh my Posh packs the initialization scipts for the different shells, but go does not ship with the ability to add
|
||||
files other than go code to your compiled binary. [go-bindata][go-bindata] allows us to add initialization files and
|
||||
ship them in the source code to easily bootstrap your shell with Oh my Posh.
|
||||
|
||||
There are multiple ways to install go-bindata.
|
||||
|
||||
<Tabs
|
||||
defaultValue="homebrew"
|
||||
values={[
|
||||
{ label: 'homebrew', value: 'homebrew', },
|
||||
{ label: 'linux', value: 'linux', },
|
||||
{ label: 'source', value: 'source', },
|
||||
]
|
||||
}>
|
||||
<TabItem value="homebrew">
|
||||
|
||||
```bash
|
||||
brew install go-bindata
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="linux">
|
||||
|
||||
```bash
|
||||
curl --silent --location --output /usr/local/bin/go-bindata https://github.com/kevinburke/go-bindata/releases/download/v3.11.0/go-bindata-linux-amd64
|
||||
chmod 755 /usr/local/bin/go-bindata
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="source">
|
||||
|
||||
```bash
|
||||
go get -u github.com/kevinburke/go-bindata/...
|
||||
```
|
||||
|
||||
Be careful as executing this inside the Oh my Posh repository will adjust the `go.mod` file with this dependency.
|
||||
Today, there's no way to install a dependency system wide for go, although that's [in the works][go-global].
|
||||
Make sure to remove this before submitting a PR as there's [a check][pr-go-mod] in place to avoid adding unused dependencies.
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Running tests
|
||||
|
||||
Before doing anything else, we need to pack the initialization scripts into the source.
|
||||
|
||||
```bash
|
||||
go generate
|
||||
```
|
||||
|
||||
Provided the previous steps were performed correctly, you should now see a new source file called `init.go`.
|
||||
Do not wory about this file as it's ignored, we generate it every time the app gets build.
|
||||
|
||||
### 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
|
||||
```
|
||||
|
||||
## 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-posh3/blob/main/.github/workflows/gomod.yml
|
||||
[gh-pr]: https://github.com/JanDeDobbeleer/oh-my-posh3/pulls
|
|
@ -42,7 +42,7 @@ module.exports = {
|
|||
{
|
||||
type: "category",
|
||||
label: "Contributing",
|
||||
items: ["contributing_segment"],
|
||||
items: ["contributing_started", "contributing_segment"],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue