feat: add docs

This commit is contained in:
Jan De Dobbeleer 2020-10-05 11:33:12 +02:00 committed by Jan De Dobbeleer
parent 20a2510051
commit f85057bbf6
31 changed files with 11781 additions and 0 deletions

20
docs/.gitignore vendored Normal file
View file

@ -0,0 +1,20 @@
# Dependencies
/node_modules
# Production
/build
# Generated files
.docusaurus
.cache-loader
# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

7
docs/.markdownlint.json Normal file
View file

@ -0,0 +1,7 @@
{
"MD024": false,
"MD014": false,
"line-length": {
"line_length": 120
}
}

18
docs/README.md Normal file
View file

@ -0,0 +1,18 @@
# Website
This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
## Installation
```shell
$ yarn install
```
## Local Development
```shell
$ yarn start
```
This command starts a local development server and open up a browser window.
Most changes are reflected live without having to restart the server.

298
docs/docs/configuration.md Normal file
View file

@ -0,0 +1,298 @@
---
id: configure
title: Configuration
sidebar_label: Configuration
---
Oh my Posh renders your prompt based on the definition of _blocks_ (like Lego) which contain or more _segments_.
A really simple configuration could look like this.
```json
{
"final_space": true,
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "path",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#61AFEF",
"properties": {
"prefix": "  ",
"style": "folder"
}
}
]
}
]
}
```
With this configuration, a single powerline segment is rendered that shows the name of the folder you're currently in.
To set this configuration in combination with a [Oh my Posh executable][releases], make use of the `-config` flag to
set a path to a json file containing the above code.
```bash
./oh-my-posh -config sample.json
```
If all goes according to plan, you should see the prompt being printed out on the line below. This could bring us to
the _first attention point_, you need to have a powerline enabled font installed on your machine and set as the font
in your terminal to make use of, or see the symbols being used. All the themes were created with **Meslo Nerd Font**,
which you can find [here][nf].
## General Settings
At the top you can see `final_space`. This tells the engine to add a space at the end of the prompt once all blocks and
segments are rendered. This is useful when there's conditional logic that shows or hides segments at the end of your
prompt. That way you don't have to worry about how to handle that space at the end.
> "I Like The Way You Speak Words" - Gary Goodspeed
## Block
Let's take a closer look at what defines a block.
- type: `prompt` | `newline`
- alignment: `left` | `right`
- vertical_offset: `int`
- horizontal_offset: `int`
- segments: `array` of one or more `segments`
### Type
Tells the engine what to do with the block. There are two options, either it renders one or more segments,
or it inserts a newline to start the next block on a new line. New line blocks require no additional
configuration other than the `type`.
### Alignment
Tell the engine if the block should be left or right aligned.
### Vertical offset
Move the block up or down x lines. For example `vertical_offset: 1` moves the prompt down one line, `vertical_offset: -1`
moves it up one line.
### Horizontal offset
Moves the segment to the left or the right to have it exactly where you want it to be. Works like `vertical_offset`
but on a horizontal level where a negative number moves the block left and a positive number right.
### Segments
Array of one or more segments.
## Segment
A segments is a part of the prompt with a certain context. There are different types available out of the box, if you're
looking for what's included, feel free to skip this part and browse through the [segments][segments]. Keep reading to
understand how to configure a segment.
- type: `string` any of the included [segments][segments]
- style: `powerline` | `plain` | `diamond`
- powerline_symbol: `string`
- invert_powerline: `boolean`
- leading_diamond: `string`
- trailing_diamond: `string`
- foreground: `string` [hex color code][colors]
- background: `string` [hex color code][colors]
- properties: `array` of `Property`: `string`
### Type
Takes the `string` value referencing which segment logic it needs to run (see [segments][segments] for possible values).
### Style
Oh Hi! You made it to a really interesting part, great! Style defines how a prompt is rendered. Looking at most prompt
themes out there, we identified 3 types. All of these require a different configuration and depending on the look
you want to achieve you might need to understand/use them all.
#### Powerline
What started it all for us. Makes use of a single symbol (`powerline_symbol`) to separate the segments. It takes the
background color of the previous segment (or transparent if none) and the foreground of the current one (or transparent
if we're at the last segment). Expects segments to have a colored background, else there little use for this one.
#### Plain
Simple. Colored text on a transparent background. Make sure to set `foreground` for maximum enjoyment.
#### Diamond
While Powerline works great with as single symbol, sometimes you want a segment to have a different start and end symbol.
Just like a diamond: `< my segment text >`. The difference between this and plain is that the diamond symbols take the
segment background as their foreground color.
### Powerline symbol
Text character to use when `"style": "powerline"`.
### Invert Powerline
If `true` this swaps the foreground and background colors. Can be useful when the character you want does not exist
in the perfectly mirrored variant for example.
### Leading diamond
Text character to use at the start of the segment. Will take the background color of the segment as
its foreground color.
### Trailing diamond
Text character to use at the end of the segment. Will take the background color of the segment as its foreground color.
### Foreground
Hex [color][colors] to use as the segment text foreground color.
### Background
Hex [color][colors] to use as the segment text background color.
### Properties
An array of **Properties** with a value. This is used inside of the segment logic to tweak what the output of the segment
will be. Segments have the ability to define their own Properties, but there are some general ones being used by the
engine which allow you to customize the output even more.
#### General purpose properties
You can use these on any segment, the engine is responsible for adding them correctly.
- prefix: `string`
- postfix: `string`
- ignore_folders: `[]string`
##### Prefix
The string content will be put in front of the segment's output text. Useful for symbols, text or other customizations.
##### Postfix
The string content will be put after the segment's output text. Useful for symbols, text or other customizations.
##### Ignore Folders
Sometimes you want might want to not have a segment rendered at a certain location. If so, adding the path to the
segment's configuration will not render it when in that location. The engine will simply skip it.
```json
"ignore_folders": [
"/super/secret/project"
]
```
#### Colors
You have the ability to override the foreground color for text in any property that accepts it. The syntax is custom but
should be rather straighforward: `<#ffffff>this is white</> <#FF479C>but this is pink</>`. Anything between the color start
`<#FF479C>` and end `</>` will be colored accordingly.
For example, if you want `prefix` to print a colored bracket which isn't the same as the segment's `foreground`, you can
do so like this:
```json
"prefix": "<#CB4B16>┏[</>",
```
## Full Sample
```json
{
"final_space": true,
"blocks": [
{
"type": "prompt",
"alignment": "right",
"vertical_offset": -1,
"segments": [
{
"type": "time",
"style": "plain",
"foreground": "#007ACC",
"properties": {
"time_format": "15:04:05"
}
}
]
},
{
"type": "newline"
},
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "session",
"style": "diamond",
"foreground": "#ffffff",
"background": "#ffb300",
"leading_diamond": "",
"trailing_diamond": "",
"properties": {
"user_info_separator": "@",
"postfix": " "
}
},
{
"type": "path",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#61AFEF",
"properties": {
"prefix": "  ",
"style": "folder",
"ignore_folders": [
"/super/secret/project"
]
}
},
{
"type": "git",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#193549",
"background": "#ffeb3b",
"properties": {
"branch_icon": "",
"branch_identical_icon": "≡",
"branch_ahead_icon": "↑",
"branch_behind_icon": "↓",
"branch_gone_icon": "≢",
"local_working_icon": "",
"local_staged_icon": ""
}
},
{
"type": "exit",
"style": "diamond",
"foreground": "#ffffff",
"background": "#00897b",
"leading_diamond": "",
"trailing_diamond": "",
"properties": {
"display_exit_code": false,
"always_enabled": true,
"error_color": "#e91e63",
"color_background": true,
"prefix": "<#193549> </>"
}
}
]
}
]
}
```
[releases]: https://github.com/JanDeDobbeleer/oh-my-posh3/releases/latest
[nf]: https://www.nerdfonts.com/
[segments]: /docs/battery
[colors]: https://htmlcolorcodes.com/color-chart/material-design-color-chart/

173
docs/docs/installation.mdx Normal file
View file

@ -0,0 +1,173 @@
---
id: installation
title: Manual Installation
sidebar_label: Manual Installation
---
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
### 1. Setup your terminal
Oh my Posh uses ANSI color codes under the hood, these should work everywhere,
but you may have to set `$TERM` to `xterm-256color` for it to work.
For maximum enjoyment, make sure to install a powerline enabled font. The fonts I use are patched by [Nerd Fonts][nerdfonts],
which offers a maximum of icons you can use to configure your prompt.
Oh my Posh was designed using [Meslo LGM NF][meslo], so if you happen to see missing icons either change to that font or replace the icons
by changing the [theme][themes] to your liking.
### 2. Download the latest binary
<Tabs
defaultValue="windows"
values={[
{ label: 'windows', value: 'windows', },
{ label: 'macos', value: 'macos', },
{ label: 'unix', value: 'unix', },
]
}>
<TabItem value="windows">
If you're looking to use the shell in PowerShell, there's a [PowerShell package][powershell] for your enjoyment that facilitates the whole process.
But, if you insist on doing it manually, or you use a pre-core version of PowerShell, here you go :-)
```powershell
mkdir C:\tools
Invoke-Webrequest https://github.com/JanDeDobbeleer/oh-my-posh3/releases/latest/download/posh-windows-amd64.exe -OutFile C:\tools\oh-my-posh.exe
```
</TabItem>
<TabItem value="macos">
```bash
wget https://github.com/JanDeDobbeleer/oh-my-posh3/releases/latest/download/posh-darwin-amd64 -o /usr/local/bin/oh-my-posh
chmod +x /usr/local/bin/oh-my-posh
```
</TabItem>
<TabItem value="unix">
```bash
wget https://github.com/JanDeDobbeleer/oh-my-posh3/releases/latest/download/posh-linux-amd64 -o /usr/local/bin/oh-my-posh
chmod +x /usr/local/bin/oh-my-posh
```
</TabItem>
</Tabs>
### 3. Download a theme
Find a [theme][themes] you like, download it and store it somewhere you can find it again.
### 4. Replace your existing prompt
<Tabs
defaultValue="powershell"
values={[
{ label: 'powershell', value: 'powershell', },
{ label: 'zsh', value: 'zsh', },
{ label: 'bash', value: 'bash', },
{ label: 'nix', value: 'nix', },
{ label: 'fish', value: 'fish', },
]
}>
<TabItem value="powershell">
Edit `$PROFILE` in your preferred PowerShell version and add the following lines.
```powershell
[ScriptBlock]$Prompt = {
$realLASTEXITCODE = $global:LASTEXITCODE
& "C:\tools\oh-my-posh.exe" -config "~/downloadedtheme.json" -error $realLASTEXITCODE
$global:LASTEXITCODE = $realLASTEXITCODE
Remove-Variable realLASTEXITCODE -Confirm:$false
}
Set-Item -Path Function:prompt -Value $Prompt -Force
```
</TabItem>
<TabItem value="zsh">
Add the following to `~/.zshrc`:
```bash
function powerline_precmd() {
PS1="$(oh-my-posh -config ~/downloadedtheme.json --error $?)"
}
function install_powerline_precmd() {
for s in "${precmd_functions[@]}"; do
if [ "$s" = "powerline_precmd" ]; then
return
fi
done
precmd_functions+=(powerline_precmd)
}
if [ "$TERM" != "linux" ]; then
install_powerline_precmd
fi
```
</TabItem>
<TabItem value="bash">
Add the following to `~/.bashrc` (or `~/.profile` on MacOS):
```bash
function _update_ps1() {
PS1="$(oh-my-posh -config ~/downloadedtheme.json -error $?)"
}
if [ "$TERM" != "linux" ] && [ -f oh-my-posh ]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
```
</TabItem>
<TabItem value="nix">
When using `nix-shell --pure`, `oh-my-posh` will not be accessible, and
your prompt will not appear.
As a workaround you can add this snippet to `~/.bashrc`,
which should re-enable the prompt in most cases:
```bash
# Workaround for nix-shell --pure
if [ "$IN_NIX_SHELL" == "pure" ]; then
if [ -x oh-my-posh ]; then
alias powerline-go="oh-my-posh -config ~/downloadedtheme.json"
fi
fi
```
</TabItem>
<TabItem value="fish">
Redefine `fish_prompt` in `~/.config/fish/config.fish`:
```bash
function fish_prompt
eval oh-my-posh -config ~/downloadedtheme.json -error $status
end
```
</TabItem>
</Tabs>
Make sure `~/downloadedtheme.json` points to your downloaded or adjusted theme. If the theme would be invalid, the default Agnoster prompt is printed.
### 5. Profit
🎉🎉🎉
[nerdfonts]: https://www.nerdfonts.com/
[meslo]: https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/Meslo.zip
[powershell]: /docs/powershell
[themes]: https://github.com/JanDeDobbeleer/oh-my-posh3/tree/master/themes

80
docs/docs/introduction.md Normal file
View file

@ -0,0 +1,80 @@
---
id: introduction
title: Introduction
sidebar_label: Introduction
slug: /
---
Oh my Posh is a custom prompt engine for any shell that has the ability to adjust
the prompt string with a function or variable.
## Oh my Posh 3 vs Oh my Posh 2
Oh my Posh 3 is the offspring of [Oh my Posh][omp], a prompt theme engine for PowerShell.
Oh my Posh started out by being inspired from tools like [oh my zsh][omz] when nothing was
available specifically for PowerShell.
Over the years, I switched operating system/main shell quite a lot, even on
Windows via the [WSL][wsl]. This made it so that my prompt wasn't portable enough,
I wanted the same visual/functional experience regardless
of the shell I was working in. Hello world [Oh my Posh 3][omp3]!
## Concept
Traditionally, prompt tools work with custom scripts per theme (just like [Oh my Posh][omp] did) or a lot
of CLI configuration switches to define what it looks like. With Oh my Posh, I wanted to start from a single
configuration file that could easily be shared anywhere, removing the need to really grasp what goes on underneath.
When you look at prompts like Agnoster or Paradox, you notice they usually consist of a few building
**blocks** which contain one or more **segments** that display some sort of information. The configuration of
Oh my Posh works exactly like that. Blocks are a combination of one or more segments.
The basic layout of the config file is as follows.
```json
{
"blocks": []
}
```
A [block][block] has properties that indicate its position and the [segments][segment] it will render.
```json
{
"blocks": [
{
// positioning metadata (not shown)
"segments": []
}
]
}
```
A [segment][segment] renders a single context like showing the current folder, user information or git status
when relevant. It can be styled any way you want, resulting in visualizing the prompt you are looking for.
For your convenience, the existing [themes][themes] from [Oh my Posh][omp-themes] have been added to version 3, so you
can get started even without having to understand the theming. So, let's no longer waste time on theory, have a look at the
[installation guide][install] to get started right away!
## ❤ Support ❤
[![Patreon][patreon-badge]][patreon]
[![Liberapay][liberapay-badge]][liberapay]
[![Ko-Fi][kofi-badge]][kofi]
[omp]: https://github.com/JanDeDobbeleer/oh-my-posh
[omz]: https://github.com/ohmyzsh/ohmyzsh
[omp3]: https://github.com/JanDeDobbeleer/oh-my-posh3
[wsl]: https://docs.microsoft.com/en-us/windows/wsl/install-win10
[install]: /docs/installation
[patreon-badge]: https://img.shields.io/badge/Support-Become%20a%20Patreon!-red.svg
[patreon]: https://www.patreon.com/jandedobbeleer
[liberapay-badge]: https://img.shields.io/badge/Liberapay-Donate-%23f6c915.svg
[liberapay]: https://liberapay.com/jandedobbeleer
[kofi-badge]: https://img.shields.io/badge/Ko--fi-Buy%20me%20a%20coffee!-%2346b798.svg
[kofi]: https://ko-fi.com/jandedobbeleer
[block]: /docs/configure#block
[segment]: /docs/configure#segment
[themes]: https://github.com/JanDeDobbeleer/oh-my-posh3/tree/master/themes
[omp-themes]: https://github.com/JanDeDobbeleer/oh-my-posh/tree/master/Themes

View file

@ -0,0 +1,40 @@
---
id: powershell
title: PowerShell
sidebar_label: PowerShell
---
A package that includes useful helper functions to install and configure Oh my Posh.
## Installation
```powershell
Install-Module oh-my-posh -Scope CurrentUser -AllowPrerelease
```
## Usage
### Show all themes
To display every available theme in the current directory, use the following
command.
```powershell
Get-PoshThemes
```
### Set the prompt
Autocompletion is available so it will loop through all available themes.
```powershell
Set-PoshPrompt -Theme ~/downloadedtheme.json
```
### Print the theme
Useful when you find a theme you like, but you want to tweak the settings a bit. The output is a formatted `json` string.
```powershell
Write-PoshTheme
```

View file

@ -0,0 +1,46 @@
---
id: battery
title: Battery
sidebar_label: Battery
---
## What
Battery displays the remaining power percentage for your battery.
## Sample Configuration
```json
{
"type": "battery",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#193549",
"background": "#ffeb3b",
"properties": {
"battery_icon": "",
"discharging_icon": " ",
"charging_icon": " ",
"charged_icon": " ",
"color_background": true,
"charged_color": "#4caf50",
"charging_color": "#40c4ff",
"discharging_color": "#ff5722",
"postfix": " "
}
}
```
## Properties
- battery_icon: `string` - the icon to use as a prefix for the battery percentage
- display_error: `boolean` - show the error context when failing to retrieve the battery information
- charging_icon: `string` - icon to display on the left when charging
- discharging_icon: `string` - icon to display on the left when discharging
- charged_icon: `string` - icon to display on the left when fully charged
- color_background: `boolean` - color the background or foreground for properties below
- charged_color: `string` [hex color code][colors] - color to use when fully charged
- charging_color: `string` [hex color code][colors] - color to use when charging
- discharging_color: `string` [hex color code][colors] - color to use when discharging
[colors]: https://htmlcolorcodes.com/color-chart/material-design-color-chart/

View file

@ -0,0 +1,40 @@
---
id: command
title: Command
sidebar_label: Command
---
## What
Command allows you run an arbitrary shell command. Be aware it spawn a new process to fetch the result, meaning
it will not be able to fetch session based context. When the command errors or returns an empty string, this
segment isn't rendered.
You have the ability to use `||` or `&&` to stitch commands together and achieve complex results. When using `||`
the first command that returns a string will be used (or none when they all fail to produce output that's not an
error). The `&&` functionality will join the output of the commands when successful.
## Sample Configuration
```json
{
"type": "prompt",
"alignment": "right",
"segments": [
{
"type": "command",
"style": "plain",
"foreground": "#ffffff",
"properties": {
"shell": "bash",
"command": "git log --pretty=format:%cr -1 || date +%H:%m:%S"
}
}
]
}
```
## Properties
- shell: `string` - the shell in which to run the command in. Uses `shell -c command` under the hood.
- command: `string` - the command(s) to run

38
docs/docs/segment-exit.md Normal file
View file

@ -0,0 +1,38 @@
---
id: exit
title: Exit code
sidebar_label: Exit code
---
## What
Displays the last exit code or that the last command failed based on the configuration.
## Sample Configuration
```json
{
"type": "exit",
"style": "diamond",
"foreground": "#ffffff",
"background": "#00897b",
"leading_diamond": "",
"trailing_diamond": "",
"properties": {
"display_exit_code": false,
"always_enabled": true,
"error_color": "#e91e63",
"color_background": true,
"prefix": "<#193549></> "
}
}
```
## Properties
- display_exit_code: `boolean` - show or hide the exit code
- always_enabled: `boolean` - always show the status
- color_background: `boolean` - color the background or foreground when an error occurs
- error_color: `string` [hex color code][colors] - color to use when an error occured
[colors]: https://htmlcolorcodes.com/color-chart/material-design-color-chart/

44
docs/docs/segment-git.md Normal file
View file

@ -0,0 +1,44 @@
---
id: git
title: Git
sidebar_label: Git
---
## What
Display `git status` information when in a git repository. Also works for subfolders.
Local changes can also shown by default using the following syntax for both the working and staging area:
- `+` added
- `~` modified
- `-` deleted
## Sample Configuration
```json
{
"type": "git",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#193549",
"background": "#ffeb3b",
"properties": {
"branch_icon": "",
"branch_identical_icon": "≡",
"branch_ahead_icon": "↑",
"branch_behind_icon": "↓",
"local_working_icon": "",
"local_staged_icon": ""
}
}
```
## Properties
- branch_icon: `string` - the icon to use in front of the git branch name
- branch_identical_icon: `string` - the icon to display when remote and local are identical
- branch_ahead_icon: `string` - the icon to display when the local branch is ahead of its remote
- branch_behind_icon: `string` - the icon to display when the local branch is behind its remote
- local_working_icon: `string` - the icon to display in front of the working area changes
- local_staged_icon: `string` - the icon to display in front of the staged area changes
- display_status: `boolean` - display the local changes or not

24
docs/docs/segment-node.md Normal file
View file

@ -0,0 +1,24 @@
---
id: node
title: Node
sidebar_label: Node
---
## What
Display the currently active node version when a folder contains `.js` or `.ts` files.
## Sample Configuration
```json
{
"type": "node",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#6CA35E",
"properties": {
"prefix": "  "
}
}
```

61
docs/docs/segment-path.md Normal file
View file

@ -0,0 +1,61 @@
---
id: path
title: Path
sidebar_label: Path
---
## What
Display the current path.
## Sample Configuration
```json
{
"type": "path",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#61AFEF",
"properties": {
"prefix": "  ",
"style": "folder"
}
}
```
## Properties
- folder_separator_icon: `string` - the symbol to use as a separator between folders
- home_icon: `string` - the icon to display when at `$HOME`
- folder_icon: `string` - the icon to use as a folder indication
- windows_registry_icon: `string` - the icon to display when in the Windows registry
- style: `enum` - how to display the current path
## Style
Style sets the way the path is displayed. Based on previous experience and popular themes, there are 4 flavors.
- agnoster
- short
- full
- folder
### Agnoster
Renders each folder as the `folder_icon` separated by the `folder_separator_icon`.
Only the current folder name is displayed at the end, `$HOME` is replaced by the `home_icon` if you're
inside the `$HOME` location or one of its children.
### Short
Display `$PWD` as a string, replace `$HOME` with the `home_icon` if you're inside the `$HOME` location or
one of its children.
### Full
Display `$PWD` as a string
### Folder
Display the name of the current folder.

View file

@ -0,0 +1,29 @@
---
id: python
title: Python
sidebar_label: Python
---
## What
Display the currently active python version and virtualenv when a folder contains `.py` files.
Supports conda, virtualenv and pyenv.
## Sample Configuration
```json
{
"type": "python",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#100e23",
"background": "#906cff",
"properties": {
"prefix": "  "
}
}
```
## Properties
- display_virtual_env: `boolean` - show the name of the virtualenv or not, defaults to `true`.

28
docs/docs/segment-root.md Normal file
View file

@ -0,0 +1,28 @@
---
id: root
title: Root
sidebar_label: Root
---
## What
Show when the current user is root or when in an elevated shell (Windows).
## Sample Configuration
```json
{
"type": "root",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#111111",
"background": "#ffff66",
"properties": {
"root_icon": ""
}
}
```
## Properties
- root_icon: `string` - icon to display in case of root/elevated.

View file

@ -0,0 +1,36 @@
---
id: session
title: Session
sidebar_label: Session
---
## What
Show the current user and host name.
## Sample Configuration
```json
{
"type": "session",
"style": "diamond",
"foreground": "#ffffff",
"background": "#c386f1",
"leading_diamond": "",
"trailing_diamond": "",
"properties": {
"user_info_separator": "@",
"postfix": " "
}
}
```
## Properties
- user_info_separator: `string` - text/icon to put in between the user and host name.
- user_color: `string` [hex color code][colors] - override the foreground color of the user name.
- host_color: `string` [hex color code][colors] - override the foreground color of the host name.
- display_user: `boolean` - display the user name or not default: `true`.
- display_host: `boolean` - display the host name or not default: `true`.
[colors]: https://htmlcolorcodes.com/color-chart/material-design-color-chart/

View file

@ -0,0 +1,24 @@
---
id: shell
title: Shell
sidebar_label: Shell
---
## What
Show the current shell name (zsh, powershell, bash, ...).
## Sample Configuration
```json
{
"type": "shell",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#0077c2",
"properties": {
"prefix": "  "
}
}
```

View file

@ -0,0 +1,33 @@
---
id: spotify
title: Spotify
sidebar_label: Spotify
---
## What
Show the currently playing song in the Spotify MacOS client. Only available on MacOS for obvious reasons.
Be aware this can make the prompt a tad bit slower as it needs to get a response from the Spotify player using Applescript.
## Sample Configuration
```json
{
"type": "spotify",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#1BD760",
"properties": {
"prefix": "  ",
"paused_icon": " ",
"playing_icon": " "
}
}
```
## Properties
- playing_icon: `string` - text/icon to show when playing.
- paused_icon: `string` - text/icon to show when paused.
- track_separator: `string` - text/icon to put between the artist and song name.

29
docs/docs/segment-text.md Normal file
View file

@ -0,0 +1,29 @@
---
id: text
title: Text
sidebar_label: Text
---
## What
Display text.
## Sample Configuration
```json
{
"type": "text",
"style": "plain",
"foreground": "#E06C75",
"properties": {
"prefix": "",
"text": " "
}
}
```
## Properties
- text: `string` - text/icon to display. Accepts [coloring foreground][coloring] just like `prefix` and `postfix`.
[coloring]: /docs/configure#colors

28
docs/docs/segment-time.md Normal file
View file

@ -0,0 +1,28 @@
---
id: time
title: Time
sidebar_label: Time
---
## What
Show the current timestamp.
## Sample Configuration
```json
{
"type": "time",
"style": "plain",
"foreground": "#007ACC",
"properties": {
"time_format": "15:04:05"
}
}
```
## Properties
- time_format: `string` - format to use, follows the [golang standard][format].
[format]: https://gobyexample.com/time-formatting-parsing

92
docs/docusaurus.config.js Normal file
View file

@ -0,0 +1,92 @@
module.exports = {
title: "Oh my Posh 3",
tagline: "A prompt theme engine for any shell.",
url: "https://ohmyposh.dev",
baseUrl: "/",
favicon: "img/favicon.ico",
organizationName: "jandedobbeleer",
projectName: "oh-my-posh3",
onBrokenLinks: "ignore",
themeConfig: {
sidebarCollapsible: false,
prism: {
theme: require("prism-react-renderer/themes/github"),
darkTheme: require("prism-react-renderer/themes/dracula"),
},
navbar: {
title: "Oh my Posh",
logo: {
alt: "Oh my Posh Logo",
src: "img/logo.svg",
},
items: [
{
to: "docs/",
activeBasePath: "docs",
label: "Docs",
position: "left",
},
{
href: "https://github.com/jandedobbeleer/oh-my-posh3",
label: "GitHub",
position: "right",
},
],
},
footer: {
style: "dark",
links: [
{
title: "How to",
items: [
{
label: "Getting started",
to: "docs/",
},
{
label: "Packages",
to: "docs/powershell",
},
],
},
{
title: "Social",
items: [
{
label: "GitHub",
href: "https://github.com/jandedobbeleer/oh-my-posh3",
},
{
label: "Twitter",
href: "https://twitter.com/jandedobbeleer",
},
],
},
{
title: "Built with",
items: [
{
label: "Docusaurus",
href: "https://github.com/facebook/docusaurus",
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Jan De Dobbeleer.`,
},
},
presets: [
[
"@docusaurus/preset-classic",
{
docs: {
sidebarPath: require.resolve("./sidebars.js"),
editUrl: "https://github.com/jandedobbeleer/oh-my-posh3/edit/master/docs/",
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
},
],
],
};

29
docs/package.json Normal file
View file

@ -0,0 +1,29 @@
{
"name": "website",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle"
},
"dependencies": {
"@docusaurus/core": "2.0.0-alpha.65",
"@docusaurus/preset-classic": "2.0.0-alpha.65",
"classnames": "^2.2.6",
"react": "^16.13.1",
"react-dom": "^16.13.1"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

33
docs/sidebars.js Normal file
View file

@ -0,0 +1,33 @@
module.exports = {
docs: [
{
type: "category",
label: "Getting Started",
items: ["introduction", "installation", "configure"],
},
{
type: "category",
label: "Packages",
items: ["powershell"],
},
{
type: "category",
label: "Segments",
items: [
"battery",
"command",
"exit",
"git",
"node",
"path",
"python",
"root",
"session",
"shell",
"spotify",
"text",
"time",
]
},
],
};

37
docs/src/css/custom.css Normal file
View file

@ -0,0 +1,37 @@
/* stylelint-disable docusaurus/copyright-header */
/**
* Any CSS included here will be global. The classic template
* bundles Infima by default. Infima is a CSS framework designed to
* work well for content-centric websites.
*/
/* You can override the default Infima variables here. */
:root {
--ifm-color-primary: #2c7ae0;
--ifm-color-primary-dark: rgb(38, 103, 189);
--ifm-color-primary-darker: rgb(28, 75, 138);
--ifm-color-primary-darkest: rgb(19, 51, 94);
--ifm-color-primary-light: rgb(74, 143, 232);
--ifm-color-primary-lighter: rgb(95, 157, 237);
--ifm-color-primary-lightest: rgb(130, 185, 255);
--ifm-code-font-size: 95%;
}
.docusaurus-highlight-code-line {
background-color: rgb(72, 77, 91);
display: block;
margin: 0 calc(-1 * var(--ifm-pre-padding));
padding: 0 var(--ifm-pre-padding);
}
.badge {
display: none !important;
}
.hero {
background-color: #173448;
}
.hero--image {
margin-top: 10px;
}

94
docs/src/pages/index.js Normal file
View file

@ -0,0 +1,94 @@
import Link from "@docusaurus/Link";
import useBaseUrl from "@docusaurus/useBaseUrl";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import Layout from "@theme/Layout";
import classnames from "classnames";
import React from "react";
import styles from "./styles.module.css";
const features = [
{
title: <>Colors</>,
description: (
<>
Oh my Posh enables you to use the full color set of your terminal
by using hex colors to define and render the prompt.
</>
),
},
{
title: <>Customizable</>,
description:
<>
Easily adjust existing themes or create your own. From standard segments
all the way to custom implementations.
</>,
},
{
title: <>Portable</>,
description: (
<>
No matter which shell you're using, or even how many, you can
carry the configuration from one shell and/or machine to another
for the same prompt everywhere you work.
</>
),
},
];
function Feature({ imageUrl, title, description }) {
const imgUrl = useBaseUrl(imageUrl);
return (
<div className={classnames("col col--4", styles.feature)}>
{imgUrl && (
<div className="text--center">
<img className={styles.featureImage} src={imgUrl} alt={title} />
</div>
)}
<h3>{title}</h3>
<p>{description}</p>
</div>
);
}
function Home() {
const context = useDocusaurusContext();
const { siteConfig = {} } = context;
return (
<Layout title="Home" description={`${siteConfig.tagline}`}>
<header className={classnames("hero hero--primary", styles.heroBanner)}>
<div className="container">
<h1 className="hero__title">{siteConfig.title}</h1>
<p className="hero__subtitle">{siteConfig.tagline}</p>
<div className={styles.buttons}>
<Link
className={classnames(
"button button--outline button--lg",
styles.getStarted
)}
to={useBaseUrl("docs/")}
>
Get Started
</Link>
</div>
<img class="hero--image" src="/img/hero.png" alt="Oh my Posh prompt"></img>
</div>
</header>
<main>
{features && features.length > 0 && (
<section className={styles.features}>
<div className="container">
<div className="row">
{features.map((props, idx) => (
<Feature key={idx} {...props} />
))}
</div>
</div>
</section>
)}
</main>
</Layout>
);
}
export default Home;

View file

@ -0,0 +1,42 @@
/* stylelint-disable docusaurus/copyright-header */
/**
* CSS files with the .module.css suffix will be treated as CSS modules
* and scoped locally.
*/
.heroBanner {
padding: 4rem 0;
text-align: center;
position: relative;
overflow: hidden;
}
@media screen and (max-width: 966px) {
.heroBanner {
padding: 2rem;
}
}
.buttons {
display: flex;
align-items: center;
justify-content: center;
}
.features {
display: flex;
align-items: center;
padding: 2rem 0;
width: 100%;
}
.featureImage {
height: 200px;
width: 200px;
}
.getStarted {
border-style: solid;
border-width: 1px;
}

0
docs/static/.nojekyll vendored Normal file
View file

BIN
docs/static/img/favicon.ico vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
docs/static/img/hero.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

49
docs/static/img/logo.svg vendored Normal file
View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30.851 30.851" style="enable-background:new 0 0 30.851 30.851;" xml:space="preserve">
<g>
<g id="c43_terminal">
<path d="M28.645,2.203H2.204C0.987,2.203,0,3.188,0,4.405v22.038c0,1.216,0.987,2.204,2.204,2.204h26.441
c1.215,0,2.206-0.988,2.206-2.204V4.405C30.851,3.188,29.859,2.203,28.645,2.203z M7.162,3.857c0.607,0,1.102,0.491,1.102,1.103
c0,0.607-0.494,1.098-1.102,1.098c-0.611,0-1.104-0.49-1.104-1.098C6.059,4.349,6.551,3.857,7.162,3.857z M3.855,3.857
c0.608,0,1.102,0.491,1.102,1.103c0,0.607-0.493,1.098-1.102,1.098S2.752,5.568,2.752,4.96C2.753,4.349,3.246,3.857,3.855,3.857z
M28.645,26.444H2.204V7.735h26.441V26.444z"/>
<polygon points="12.351,12.264 5.275,9.028 5.275,10.589 10.746,12.929 10.746,12.958 5.275,15.294 5.275,16.854 12.351,13.618
"/>
<rect x="15.682" y="12.199" width="3.855" height="1.486"/>
</g>
<g id="Capa_1_86_">
</g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

10309
docs/yarn.lock Normal file

File diff suppressed because it is too large Load diff