mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-09 20:44:03 -08:00
parent
f0305cefcf
commit
6aca58eef9
|
@ -32,7 +32,6 @@ Fish and PowerShell, the latter of which is the default.
|
||||||
1. Open the `.devcontainer/devcontainer.json` file and in the "*build*" section modify:
|
1. Open the `.devcontainer/devcontainer.json` file and in the "*build*" section modify:
|
||||||
|
|
||||||
- `TZ`: with [your own timezone][timezones]
|
- `TZ`: with [your own timezone][timezones]
|
||||||
- `DEFAULT_POSH_THEME`: with [your preferred theme][themes]
|
|
||||||
|
|
||||||
2. Summon the Command Panel (Ctrl+Shift+P) and select `Codespaces: Rebuild Container`
|
2. Summon the Command Panel (Ctrl+Shift+P) and select `Codespaces: Rebuild Container`
|
||||||
to rebuild your devcontainer. (This should take just a few seconds.)
|
to rebuild your devcontainer. (This should take just a few seconds.)
|
||||||
|
@ -59,4 +58,3 @@ if you do `Codespaces: Rebuild Container` again, you'll be back to the latest st
|
||||||
[codespaces-link]: https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=175405157
|
[codespaces-link]: https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=175405157
|
||||||
[devcontainer-ext]: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers
|
[devcontainer-ext]: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers
|
||||||
[timezones]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
[timezones]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||||
[themes]: https://ohmyposh.dev/docs/themes
|
|
||||||
|
|
34
configurations/configuration.dsc.yaml
Normal file
34
configurations/configuration.dsc.yaml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
|
||||||
|
properties:
|
||||||
|
resources:
|
||||||
|
- resource: Microsoft.WinGet.DSC/WinGetPackage
|
||||||
|
directives:
|
||||||
|
description: Install Visual Studio Code
|
||||||
|
allowPrerelease: false
|
||||||
|
settings:
|
||||||
|
id: Microsoft.VisualStudioCode
|
||||||
|
source: winget
|
||||||
|
- resource: Microsoft.WinGet.DSC/WinGetPackage
|
||||||
|
id: golang
|
||||||
|
directives:
|
||||||
|
description: Install Golang
|
||||||
|
allowPrerelease: false
|
||||||
|
settings:
|
||||||
|
id: GoLang.Go
|
||||||
|
source: winget
|
||||||
|
- resource: Microsoft.WinGet.DSC/WinGetPackage
|
||||||
|
dependsOn: [golang]
|
||||||
|
directives:
|
||||||
|
description: Install golangci-lint
|
||||||
|
allowPrerelease: false
|
||||||
|
settings:
|
||||||
|
id: GolangCI.golangci-lint
|
||||||
|
source: winget
|
||||||
|
- resource: Microsoft.WinGet.DSC/WinGetPackage
|
||||||
|
directives:
|
||||||
|
description: Install NodeJS
|
||||||
|
allowPrerelease: false
|
||||||
|
settings:
|
||||||
|
id: OpenJS.NodeJS
|
||||||
|
source: winget
|
||||||
|
configurationVersion: 0.2.0
|
|
@ -4,15 +4,39 @@ title: Get Started
|
||||||
sidebar_label: Get Started
|
sidebar_label: Get Started
|
||||||
---
|
---
|
||||||
|
|
||||||
|
import Tabs from "@theme/Tabs";
|
||||||
|
import TabItem from "@theme/TabItem";
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
|
To clone your fork of Oh My Posh locally, open the terminal and replace `<user>` with your Github username.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
git clone git@github.com:<user>/oh-my-posh.git
|
||||||
|
```
|
||||||
|
|
||||||
## Install dependencies
|
## Install dependencies
|
||||||
|
|
||||||
|
<Tabs
|
||||||
|
defaultValue="manual"
|
||||||
|
groupId="git"
|
||||||
|
values={[
|
||||||
|
{ label: 'Manual', value: 'manual', },
|
||||||
|
{ label: 'Winget', value: 'winget', },
|
||||||
|
]
|
||||||
|
}>
|
||||||
|
<TabItem value="manual">
|
||||||
|
|
||||||
### go
|
### go
|
||||||
|
|
||||||
The codebase is in [go][go], meaning we need a working go setup before we can do anything else.
|
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!
|
Have a look at the [go guide][go-started] to get up and running with go in no time!
|
||||||
|
|
||||||
:::caution
|
:::caution
|
||||||
Oh My Posh needs at least go 1.18.
|
Oh My Posh needs at least go 1.22
|
||||||
:::
|
:::
|
||||||
|
|
||||||
### golangci-lint
|
### golangci-lint
|
||||||
|
@ -20,57 +44,88 @@ Oh My Posh needs at least go 1.18.
|
||||||
To make sure we keep on writing quality code, [golang-ci lint][golang-ci-lint] is used to validate the changes.
|
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.
|
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
|
### nodejs
|
||||||
|
|
||||||
The source is hosted on [Github][omp]. When you want to contribute, create a [fork][gh-fork] so you can make changes in
|
The documentation is written in markdown and uses [Docusaurus][docusaurus] to generate the website. To validate your
|
||||||
your repository and create a pull request in the official Oh My Posh repository.
|
changes, you'll need to have [nodejs] installed so you can run the website locally.
|
||||||
|
|
||||||
Clone your fork of Oh My Posh locally, replace `<user>` with your Github username.
|
### Visual Studio Code
|
||||||
|
|
||||||
```bash
|
If you're not using Visual Studio Code yet, it's a great editor to work with go and the project has the configuration built-in.
|
||||||
git clone git@github.com:<user>/oh-my-posh.git
|
You can download it [here][code].
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="winget">
|
||||||
|
|
||||||
|
The project has a [winget] [configuration][winget-configuration] file available to install the dependencies.
|
||||||
|
Navigate to the cloned repository and use winget to install the dependencies:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
winget configure configurations/configuration.dsc.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Done! Restart the terminal and you're ready to continue below.
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</Tabs>
|
||||||
|
|
||||||
|
## Configure Visual Studio Code
|
||||||
|
|
||||||
|
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.
|
||||||
|
- 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.
|
||||||
|
|
||||||
## Running tests
|
## Running tests
|
||||||
|
|
||||||
The go source code can be found in the `src/` directory, make sure to change to that one before continuing.
|
The go source code can be found in the `src/` directory, make sure to navigate to that one before continuing.
|
||||||
|
|
||||||
### Unit tests
|
### Unit tests
|
||||||
|
|
||||||
```bash
|
```powershell
|
||||||
go test -v ./...
|
go test -v ./...
|
||||||
```
|
```
|
||||||
|
|
||||||
### golangci-lint
|
### golangci-lint
|
||||||
|
|
||||||
```bash
|
```powershell
|
||||||
golangci-lint run
|
golangci-lint run
|
||||||
```
|
```
|
||||||
|
|
||||||
## Building the app
|
## 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 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
|
the changes by running the prompt in your shell as well.
|
||||||
your path to add your own Oh My Posh binary to and immediately see the changes appear in your shell.
|
|
||||||
|
|
||||||
```bash
|
If you already have Oh My Posh in your `PATH`, you'll need to either use that one as an output parameter, or make sure
|
||||||
|
that the `$GOPATH/bin/` folder precedes the Oh My Posh binary in your `PATH`.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
go build -o (Get-Command oh-my-posh.exe).Source
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$env:PATH = "$env:GOPATH\bin;$env:PATH"
|
||||||
go build -o $GOPATH/bin/oh-my-posh
|
go build -o $GOPATH/bin/oh-my-posh
|
||||||
```
|
```
|
||||||
|
|
||||||
## Get an editor
|
## Run the website locally
|
||||||
|
|
||||||
A default config(.vscode folder) for [Visual Studio Code][code] is available in the repo:
|
Open your terminal and navigate to the `website` folder in the repository. Install the dependencies and start the website:
|
||||||
|
|
||||||
- golangci-lint is configured as the default linter.
|
```powershell
|
||||||
- Recommended extensions available for a smooth bootstrap.
|
npm install
|
||||||
|
npm start
|
||||||
|
```
|
||||||
|
|
||||||
![recommended extensions](/img/recommended_extensions.png "Recommended extensions" )
|
This will start a local server on `http://localhost:3000` where you can see your changes.
|
||||||
- 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
|
### Extra tips
|
||||||
|
|
||||||
|
@ -108,3 +163,7 @@ With everything set up, you're ready to start making changes and create your fir
|
||||||
[gh-fork]: https://guides.github.com/activities/forking/
|
[gh-fork]: https://guides.github.com/activities/forking/
|
||||||
[code]: https://code.visualstudio.com
|
[code]: https://code.visualstudio.com
|
||||||
[delve]: https://github.com/go-delve/delve
|
[delve]: https://github.com/go-delve/delve
|
||||||
|
[docusaurus]: https://docusaurus.io
|
||||||
|
[winget-configuration]: https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/configuration/configuration.dsc.yaml
|
||||||
|
[winget]: https://learn.microsoft.com/en-us/windows/package-manager/winget/
|
||||||
|
[nodejs]: https://nodejs.org/en/download/
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 102 KiB |
Loading…
Reference in a new issue