Skip to content

Commit b94f793

Browse files
authored
Merge pull request #3 from xeyossr/feat/add_newline
2 parents baee892 + f2e9999 commit b94f793

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@
2525

2626
- ⚙️ **Modular architecture** – Easily customize each part of the prompt
2727
- 🎨 **Color palette support** – Define theme colors using `palette` and reference them in components
28-
- 🧩 **Components** – Includes built-in components like:
29-
- `cwd`, `username`, `hostname`, `character`, `time`
30-
- with more planned in the future.
28+
- 🧩 **Components** – Includes built-in components such as:
29+
- `cwd`, `username`, `hostname`, `character`, `time`, `git`, and more
3130
-**Blazing fast** – Lightweight Go binary with minimal memory usage
3231
- 🧪 **Extensible** – Future support planned for right prompt, custom modules, async updates
3332

@@ -75,6 +74,8 @@ prompt = '''
7574
{cwd}
7675
{character} '''
7776

77+
add_newline = true
78+
7879
[cwd]
7980
format = "^(lavender)[{cwd}]^"
8081
max_length = 5

internal/components/prompt.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ func GenPrompt(config models.PromptConfig) (string, error) {
7979

8080
var builder strings.Builder
8181

82+
if config.AddNewLine {
83+
builder.WriteString("\n")
84+
}
85+
8286
for _, part := range parts {
8387
if part.IsComponent {
8488
_, ok := components[part.Value]

internal/config/default.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import (
66
)
77

88
var DefaultConfig = models.PromptConfig{
9-
Prompt: "{cwd} {git}\n{character} ",
9+
Prompt: "{cwd} {git}\n{character} ",
10+
AddNewLine: true,
11+
1012
Hostname: models.HostnameConfig{
1113
Format: nil,
1214
},

internal/models/models.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ type Result struct {
1414
}
1515

1616
type PromptConfig struct {
17-
Prompt string `toml:"prompt"`
17+
Prompt string `toml:"prompt"`
18+
AddNewLine bool `toml:"add_newline"`
1819

1920
Hostname HostnameConfig `toml:"hostname"`
2021
Username UsernameConfig `toml:"username"`

0 commit comments

Comments
 (0)