mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 04:19:41 -08:00
parent
395a250ca5
commit
7cb752abcb
|
@ -47,16 +47,22 @@ theme.
|
|||
oh-my-posh -config sample.json -shell universal
|
||||
```
|
||||
|
||||
If all goes according to plan, you should see the prompt being printed out on the line below. In case you see a lot of boxes with
|
||||
question marks, [set up your terminal][setupterm] to use a supported font before continuing.
|
||||
If all goes according to plan, you should see the prompt being printed out on the line below. In case you see a lot of
|
||||
boxes with question marks, [set up your terminal][setupterm] to use a supported font before continuing.
|
||||
|
||||
## General Settings
|
||||
|
||||
- final_space: `boolean` - when true adds a space at the end of the prompt
|
||||
- console_title: `boolean` - when true sets the current location as the console title
|
||||
- console_title_style: `string` - the title to set in the console - defaults to `folder`
|
||||
|
||||
> "I Like The Way You Speak Words" - Gary Goodspeed
|
||||
|
||||
### Console Title Style
|
||||
|
||||
- `folder`: show the current folder name
|
||||
- `path`: show the current path
|
||||
|
||||
## Block
|
||||
|
||||
Let's take a closer look at what defines a block.
|
||||
|
|
|
@ -140,7 +140,14 @@ func (e *engine) render() {
|
|||
}
|
||||
}
|
||||
if e.settings.ConsoleTitle {
|
||||
switch e.settings.ConsoleTitleStyle {
|
||||
case FullPath:
|
||||
e.renderer.setConsoleTitle(e.env.getcwd())
|
||||
case FolderName:
|
||||
fallthrough
|
||||
default:
|
||||
e.renderer.setConsoleTitle(base(e.env.getcwd(), e.env))
|
||||
}
|
||||
}
|
||||
e.renderer.creset()
|
||||
if e.settings.FinalSpace {
|
||||
|
|
10
settings.go
10
settings.go
|
@ -10,6 +10,7 @@ import (
|
|||
type Settings struct {
|
||||
FinalSpace bool `json:"final_space"`
|
||||
ConsoleTitle bool `json:"console_title"`
|
||||
ConsoleTitleStyle ConsoleTitleStyle `json:"console_title_style"`
|
||||
Blocks []*Block `json:"blocks"`
|
||||
}
|
||||
|
||||
|
@ -19,6 +20,9 @@ type BlockType string
|
|||
// BlockAlignment aligment of a Block
|
||||
type BlockAlignment string
|
||||
|
||||
// ConsoleTitleStyle defines how to show the title in the console window
|
||||
type ConsoleTitleStyle string
|
||||
|
||||
const (
|
||||
// Prompt writes one or more Segments
|
||||
Prompt BlockType = "prompt"
|
||||
|
@ -28,6 +32,10 @@ const (
|
|||
Left BlockAlignment = "left"
|
||||
// Right aligns right
|
||||
Right BlockAlignment = "right"
|
||||
// FolderName show the current folder name
|
||||
FolderName ConsoleTitleStyle = "folder"
|
||||
// FullPath show the current path
|
||||
FullPath ConsoleTitleStyle = "path"
|
||||
)
|
||||
|
||||
// Block defines a part of the prompt with optional segments
|
||||
|
@ -75,6 +83,8 @@ func loadUserConfiguration(env environmentInfo) (*Settings, error) {
|
|||
func getDefaultSettings(info string) *Settings {
|
||||
settings := &Settings{
|
||||
FinalSpace: true,
|
||||
ConsoleTitle: true,
|
||||
ConsoleTitleStyle: FolderName,
|
||||
Blocks: []*Block{
|
||||
{
|
||||
Type: Prompt,
|
||||
|
|
Loading…
Reference in a new issue