devstuff 2.9.0__py3-none-any.whl → 2.10.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dev_setup/configure/starship/icons.py +166 -0
- dev_setup/configure/starship/model.py +22 -2
- dev_setup/configure/starship/render.py +39 -24
- dev_setup/configure/starship/wizard.py +309 -0
- dev_setup/ui.py +9 -0
- {devstuff-2.9.0.dist-info → devstuff-2.10.0.dist-info}/METADATA +1 -1
- {devstuff-2.9.0.dist-info → devstuff-2.10.0.dist-info}/RECORD +9 -8
- {devstuff-2.9.0.dist-info → devstuff-2.10.0.dist-info}/WHEEL +0 -0
- {devstuff-2.9.0.dist-info → devstuff-2.10.0.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"""A curated catalog of Nerd Font glyphs and emoji for the icon picker.
|
|
2
|
+
|
|
3
|
+
Every entry has a stable ``key``, a human-readable ``label`` (what the filterable
|
|
4
|
+
picker searches against), the ``glyph`` string that gets emitted into the config,
|
|
5
|
+
and one or more ``categories`` so the picker can group them. Glyphs are written as
|
|
6
|
+
escapes with their Nerd Font names so the source stays reviewable without the font
|
|
7
|
+
installed — the same convention as ``model.py``'s section icons.
|
|
8
|
+
|
|
9
|
+
The catalog is deliberately not exhaustive: it covers the domains the wizard's
|
|
10
|
+
sections live in (languages, cloud, git, shell, general) with a handful of
|
|
11
|
+
alternatives each, plus a set of generic shapes that work for anything. A user
|
|
12
|
+
who wants a glyph not listed here can type one into the picker's free-text input.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
from dataclasses import dataclass
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@dataclass(frozen=True)
|
|
21
|
+
class Icon:
|
|
22
|
+
key: str
|
|
23
|
+
label: str
|
|
24
|
+
glyph: str
|
|
25
|
+
categories: tuple[str, ...] = ()
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# Category constants — keep in sync with the wizard's grouping.
|
|
29
|
+
CAT_LANG = "Languages"
|
|
30
|
+
CAT_CLOUD = "Cloud & Infrastructure"
|
|
31
|
+
CAT_GIT = "Git"
|
|
32
|
+
CAT_SHELL = "Shell"
|
|
33
|
+
CAT_GENERAL = "General"
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
ICONS: tuple[Icon, ...] = (
|
|
37
|
+
# -- General -----------------------------------------------------------------
|
|
38
|
+
Icon("folder", "Folder", "\uf07b ", (CAT_GENERAL,)), # nf-fa-folder
|
|
39
|
+
Icon("folder_open", "Open folder", "\uf07c ", (CAT_GENERAL,)), # nf-fa-folder_open
|
|
40
|
+
Icon("package", "Package", "\U000f03d7 ", (CAT_GENERAL,)), # nf-md-package_variant_closed
|
|
41
|
+
Icon("package_box", "Package box", "\uf1b6 ", (CAT_GENERAL,)), # nf-fa-inbox
|
|
42
|
+
Icon("container", "Container", "\U000f021b ", (CAT_GENERAL,)), # nf-md-container
|
|
43
|
+
Icon("cube", "Cube", "\uf1b2 ", (CAT_GENERAL,)), # nf-fa-cube
|
|
44
|
+
Icon("gear", "Gear", "\uf013 ", (CAT_GENERAL,)), # nf-fa-cog
|
|
45
|
+
Icon("wrench", "Wrench", "\uf0ad ", (CAT_GENERAL,)), # nf-fa-wrench
|
|
46
|
+
Icon("rocket", "Rocket", "\uf135 ", (CAT_GENERAL,)), # nf-fa-rocket
|
|
47
|
+
Icon("star", "Star", "\uf005 ", (CAT_GENERAL,)), # nf-fa-star
|
|
48
|
+
Icon("heart", "Heart", "\uf004 ", (CAT_GENERAL,)), # nf-fa-heart
|
|
49
|
+
Icon("check", "Check mark", "\uf00c ", (CAT_GENERAL,)), # nf-fa-check
|
|
50
|
+
Icon("x", "X mark", "\uf00d ", (CAT_GENERAL,)), # nf-fa-times
|
|
51
|
+
Icon("lightbulb", "Light bulb", "\uf0eb ", (CAT_GENERAL,)), # nf-fa-lightbulb_o
|
|
52
|
+
Icon("fire", "Fire", "\uf06d ", (CAT_GENERAL,)), # nf-fa-fire
|
|
53
|
+
Icon("bolt", "Lightning bolt", "\uf0e7 ", (CAT_GENERAL,)), # nf-fa-bolt
|
|
54
|
+
Icon("terminal", "Terminal", "\uf120 ", (CAT_GENERAL,)), # nf-fa-terminal
|
|
55
|
+
Icon("keyboard", "Keyboard", "\uf11c ", (CAT_GENERAL,)), # nf-fa-keyboard_o
|
|
56
|
+
Icon("clock", "Clock", "\uf017 ", (CAT_GENERAL,)), # nf-fa-clock_o
|
|
57
|
+
Icon("hourglass", "Hourglass", "\uf252 ", (CAT_GENERAL,)), # nf-fa-hourglass_half
|
|
58
|
+
Icon("chart", "Bar chart", "\uf080 ", (CAT_GENERAL,)), # nf-fa-bar_chart
|
|
59
|
+
Icon("database", "Database", "\uf1c0 ", (CAT_GENERAL,)), # nf-fa-database
|
|
60
|
+
Icon("server", "Server", "\uf233 ", (CAT_GENERAL,)), # nf-fa-server
|
|
61
|
+
Icon("globe", "Globe", "\uf0ac ", (CAT_GENERAL,)), # nf-fa-globe
|
|
62
|
+
Icon("link", "Link", "\uf0c1 ", (CAT_GENERAL,)), # nf-fa-link
|
|
63
|
+
|
|
64
|
+
# -- Git ---------------------------------------------------------------------
|
|
65
|
+
Icon("git_branch", "Git branch", "\ue0a0 ", (CAT_GIT,)), # nf-pl-branch
|
|
66
|
+
Icon("git_branch_alt", "Git branch (alt)", "\uf126 ", (CAT_GIT,)), # nf-fa-code_fork
|
|
67
|
+
Icon("git_commit", "Git commit", "\ue0a1 ", (CAT_GIT,)), # nf-pl-narrow
|
|
68
|
+
Icon("git_merge", "Git merge", "\ue0a3 ", (CAT_GIT,)), # nf-pl-branch
|
|
69
|
+
Icon("git_pull", "Git pull request", "\uf09b ", (CAT_GIT,)), # nf-fa-github_alt
|
|
70
|
+
Icon("fork", "Fork", "\uf126 ", (CAT_GIT,)), # nf-fa-code_fork
|
|
71
|
+
Icon("diff", "Diff", "\ue728 ", (CAT_GIT,)), # nf-seti-git
|
|
72
|
+
|
|
73
|
+
# -- Languages ---------------------------------------------------------------
|
|
74
|
+
Icon("nodejs_small", "Node.js small", "\ue718 ", (CAT_LANG,)), # nf-dev-nodejs_small
|
|
75
|
+
Icon("nodejs", "Node.js", "\ue74e ", (CAT_LANG,)), # nf-dev-nodejs_large
|
|
76
|
+
Icon("js", "JavaScript", "\ue74e ", (CAT_LANG,)),
|
|
77
|
+
Icon("js_square", "JavaScript (square)", "\ue781 ", (CAT_LANG,)), # nf-dev-javascript
|
|
78
|
+
Icon("typescript", "TypeScript", "\ue628 ", (CAT_LANG,)), # nf-seti-file_type_ts
|
|
79
|
+
Icon("deno", "Deno", "\ue70c ", (CAT_LANG,)), # nf-seti-file_type_deno
|
|
80
|
+
Icon("deno_robot", "Deno (robot)", "\U000f06a9 ", (CAT_LANG,)), # nf-md-robot
|
|
81
|
+
Icon("bun", "Bun (croissant)", "\U000f07f0 ", (CAT_LANG,)), # nf-md-food_croissant
|
|
82
|
+
Icon("python", "Python", "\ue73c ", (CAT_LANG,)), # nf-dev-python
|
|
83
|
+
Icon("python_alt", "Python (alt)", "\ue235 ", (CAT_LANG,)), # nf-fa-python
|
|
84
|
+
Icon("rust", "Rust", "\ue7a8 ", (CAT_LANG,)), # nf-dev-rust
|
|
85
|
+
Icon("rust_crab", "Rust (crab)", "\U000f0f80 ", (CAT_LANG,)), # nf-md-crab
|
|
86
|
+
Icon("go", "Go", "\ue627 ", (CAT_LANG,)), # nf-seti-go
|
|
87
|
+
Icon("go_gopher", "Go (gopher)", "\ue626 ", (CAT_LANG,)), # nf-seti-go
|
|
88
|
+
Icon("java", "Java", "\ue256 ", (CAT_LANG,)), # nf-dev-java
|
|
89
|
+
Icon("java_cup", "Java (cup)", "\uf266 ", (CAT_LANG,)), # nf-fa-java
|
|
90
|
+
Icon("php", "PHP", "\ue73d ", (CAT_LANG,)), # nf-dev-php
|
|
91
|
+
Icon("php_elephant", "PHP (elephant)", "\ue608 ", (CAT_LANG,)), # nf-seti-php
|
|
92
|
+
Icon("ruby", "Ruby", "\ue791 ", (CAT_LANG,)), # nf-dev-ruby
|
|
93
|
+
Icon("ruby_gem", "Ruby (gem)", "\uf219 ", (CAT_LANG,)), # nf-fa-ruby
|
|
94
|
+
Icon("elixir", "Elixir (droplet)", "\U000f078b ", (CAT_LANG,)), # nf-md-droplet
|
|
95
|
+
Icon("elixir_alt", "Elixir", "\ue62d ", (CAT_LANG,)), # nf-seti-elixir
|
|
96
|
+
Icon("dotnet", ".NET", "\U000f071e ", (CAT_LANG,)), # nf-md-microsoft_dot_net
|
|
97
|
+
Icon("csharp", "C#", "\U000f031b ", (CAT_LANG,)), # nf-md-language_csharp
|
|
98
|
+
Icon("cpp", "C++", "\U000f061b ", (CAT_LANG,)), # nf-md-language_cpp
|
|
99
|
+
Icon("c", "C", "\U000f061c ", (CAT_LANG,)), # nf-md-language_c
|
|
100
|
+
Icon("swift", "Swift", "\ue755 ", (CAT_LANG,)), # nf-dev-swift
|
|
101
|
+
Icon("kotlin", "Kotlin", "\ue634 ", (CAT_LANG,)), # nf-seti-file_type_kotlin
|
|
102
|
+
Icon("scala", "Scala", "\ue737 ", (CAT_LANG,)), # nf-dev-scala
|
|
103
|
+
Icon("haskell", "Haskell", "\ue77f ", (CAT_LANG,)), # nf-dev-haskell
|
|
104
|
+
Icon("lua", "Lua", "\ue620 ", (CAT_LANG,)), # nf-seti-file_type_lua
|
|
105
|
+
Icon("perl", "Perl", "\ue769 ", (CAT_LANG,)), # nf-dev-perl
|
|
106
|
+
Icon("clojure", "Clojure", "\ue76a ", (CAT_LANG,)), # nf-dev-clojure
|
|
107
|
+
Icon("zig", "Zig", "\U000f071f ", (CAT_LANG,)), # nf-md-language_zig
|
|
108
|
+
|
|
109
|
+
# -- Cloud & Infrastructure --------------------------------------------------
|
|
110
|
+
Icon("docker", "Docker", "\U000f0868 ", (CAT_CLOUD,)), # nf-md-docker
|
|
111
|
+
Icon("docker_whale", "Docker (whale)", "\uf308 ", (CAT_CLOUD,)), # nf-fa-docker
|
|
112
|
+
Icon("kubernetes", "Kubernetes", "\U000f10fe ", (CAT_CLOUD,)), # nf-md-kubernetes
|
|
113
|
+
Icon("kubernetes_alt", "Kubernetes (alt)", "\ue0b6 ", (CAT_CLOUD,)),
|
|
114
|
+
Icon("aws", "AWS", "\ue7ad ", (CAT_CLOUD,)), # nf-dev-aws
|
|
115
|
+
Icon("aws_alt", "AWS (alt)", "\uf270 ", (CAT_CLOUD,)), # nf-fa-aws
|
|
116
|
+
Icon("gcp", "Google Cloud", "\ue7b3 ", (CAT_CLOUD,)), # nf-dev-google_cloud_platform
|
|
117
|
+
Icon("gcp_cloud", "Google Cloud (cloud)", "\uf0c2 ", (CAT_CLOUD,)), # nf-fa-cloud
|
|
118
|
+
Icon("azure", "Azure", "\U000f0825 ", (CAT_CLOUD,)), # nf-md-microsoft_azure
|
|
119
|
+
Icon("terraform", "Terraform", "\U000f1062 ", (CAT_CLOUD,)), # nf-md-terraform
|
|
120
|
+
Icon("terraform_alt", "Terraform (alt)", "\ue0a3 ", (CAT_CLOUD,)),
|
|
121
|
+
Icon("nix", "Nix", "\U000f1105 ", (CAT_CLOUD,)), # nf-md-nix
|
|
122
|
+
Icon("ansible", "Ansible", "\uf195 ", (CAT_CLOUD,)), # nf-fa-building
|
|
123
|
+
Icon("helm", "Helm", "\uf298 ", (CAT_CLOUD,)), # nf-fa-ship
|
|
124
|
+
Icon("cloud", "Cloud", "\uf0c2 ", (CAT_CLOUD,)), # nf-fa-cloud
|
|
125
|
+
Icon("server_alt", "Server (alt)", "\U000f051b ", (CAT_CLOUD,)), # nf-md-server
|
|
126
|
+
Icon("shield", "Shield", "\uf132 ", (CAT_CLOUD,)), # nf-fa-shield
|
|
127
|
+
|
|
128
|
+
# -- Shell -------------------------------------------------------------------
|
|
129
|
+
Icon("prompt_arrow", "Prompt arrow", "\u276f ", (CAT_SHELL,)), # ❯ — standard Unicode, not Nerd Font
|
|
130
|
+
Icon("prompt_dollar", "Dollar sign", "$ ", (CAT_SHELL,)),
|
|
131
|
+
Icon("prompt_lambda", "Lambda", "\u03bb ", (CAT_SHELL,)), # λ — standard Unicode
|
|
132
|
+
Icon("prompt_star", "Star prompt", "\uf005 ", (CAT_SHELL,)), # nf-fa-star
|
|
133
|
+
Icon("prompt_bang", "Bang", "! ", (CAT_SHELL,)),
|
|
134
|
+
Icon("jobs", "Background jobs (sparkle)", "\uf005 ", (CAT_SHELL,)), # nf-fa-star
|
|
135
|
+
Icon("jobs_alt", "Background jobs (gear)", "\uf013 ", (CAT_SHELL,)), # nf-fa-cog
|
|
136
|
+
Icon("error_x", "Error (X)", "\uf00d ", (CAT_SHELL,)), # nf-fa-times
|
|
137
|
+
Icon("error_x_circle", "Error (X in circle)", "\uf057 ", (CAT_SHELL,)), # nf-fa-times_circle
|
|
138
|
+
Icon("error_bang", "Error (warning)", "\uf071 ", (CAT_SHELL,)), # nf-fa-warning
|
|
139
|
+
Icon("error_skull", "Error (skull)", "\U000f05dc ", (CAT_SHELL,)), # nf-md-skull
|
|
140
|
+
Icon("shell_depth", "Shell depth (arrows)", "\uf0aa ", (CAT_SHELL,)), # nf-fa-angle_double_up
|
|
141
|
+
Icon("clock_alt", "Clock (alarm)", "\uf017 ", (CAT_SHELL,)),
|
|
142
|
+
Icon("user", "User", "\uf007 ", (CAT_SHELL,)), # nf-fa-user
|
|
143
|
+
Icon("host", "Host / server", "\uf233 ", (CAT_SHELL,)), # nf-fa-server
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
ICONS_BY_KEY: dict[str, Icon] = {i.key: i for i in ICONS}
|
|
147
|
+
ICON_CATEGORIES: tuple[str, ...] = (CAT_GENERAL, CAT_GIT, CAT_LANG, CAT_CLOUD, CAT_SHELL)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def icons_by_category() -> dict[str, list[Icon]]:
|
|
151
|
+
"""Group icons by category, preserving declaration order within each group."""
|
|
152
|
+
grouped: dict[str, list[Icon]] = {cat: [] for cat in ICON_CATEGORIES}
|
|
153
|
+
for icon in ICONS:
|
|
154
|
+
for cat in icon.categories:
|
|
155
|
+
if cat in grouped:
|
|
156
|
+
grouped[cat].append(icon)
|
|
157
|
+
return grouped
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def find_icon_by_glyph(glyph: str) -> Icon | None:
|
|
161
|
+
"""The icon whose glyph matches, or None. Used to mark the current choice in
|
|
162
|
+
the picker — a section's default icon is a raw glyph, not a catalog key."""
|
|
163
|
+
for icon in ICONS:
|
|
164
|
+
if icon.glyph == glyph:
|
|
165
|
+
return icon
|
|
166
|
+
return None
|
|
@@ -788,6 +788,13 @@ class StarshipConfig:
|
|
|
788
788
|
# Off gives starship's own "no runtime versions" look: the language sections still
|
|
789
789
|
# say *which* toolchain a project uses, without the number nobody reads.
|
|
790
790
|
show_versions: bool = True
|
|
791
|
+
# Per-section overrides chosen in the wizard's "Customize" steps. A colour
|
|
792
|
+
# override is a literal starship colour (hex or ANSI name) that replaces the
|
|
793
|
+
# section's palette role; an icon override is a glyph/text string that replaces
|
|
794
|
+
# the section's default symbol. Both are keyed by section key and empty dicts
|
|
795
|
+
# mean "use the palette/section defaults" — the common path.
|
|
796
|
+
color_overrides: dict[str, str] = field(default_factory=dict)
|
|
797
|
+
icon_overrides: dict[str, str] = field(default_factory=dict)
|
|
791
798
|
|
|
792
799
|
# -- resolved views the emitter and previews share ----------------------
|
|
793
800
|
|
|
@@ -818,14 +825,27 @@ class StarshipConfig:
|
|
|
818
825
|
return left, right
|
|
819
826
|
|
|
820
827
|
def symbol(self, section: Section) -> str:
|
|
821
|
-
"""The glyph for this section under the current preset
|
|
822
|
-
|
|
828
|
+
"""The glyph for this section under the current preset, honouring any
|
|
829
|
+
per-section icon override from the wizard's "Customize icons" step."""
|
|
830
|
+
if section.key in self.icon_overrides:
|
|
831
|
+
symbol = self.icon_overrides[section.key]
|
|
832
|
+
else:
|
|
833
|
+
symbol = section.icon if self.preset_spec.nerd_font else section.plain
|
|
823
834
|
if section.takes_version and not self.show_versions:
|
|
824
835
|
# Every versioned body is `$symbol$version`, so with the version gone the
|
|
825
836
|
# symbol's trailing space would sit at the end of the segment.
|
|
826
837
|
symbol = symbol.rstrip()
|
|
827
838
|
return symbol
|
|
828
839
|
|
|
840
|
+
def section_color(self, section: Section) -> str:
|
|
841
|
+
"""The colour this section renders in — a per-section override if one was
|
|
842
|
+
set in the wizard, otherwise the section's palette role name (which
|
|
843
|
+
starship resolves against the emitted ``[palettes.<name>]`` table). Both
|
|
844
|
+
forms are valid in a starship style string, so the emitter and the offline
|
|
845
|
+
preview can use this uniformly."""
|
|
846
|
+
override = self.color_overrides.get(section.key)
|
|
847
|
+
return override if override is not None else section.role
|
|
848
|
+
|
|
829
849
|
def body(self, section: Section) -> str:
|
|
830
850
|
"""The module's format body under the current preset — what goes inside
|
|
831
851
|
`[…]($style)`. The emitter and the offline preview both derive from this, so
|
|
@@ -48,15 +48,19 @@ def _val(value: Any) -> str:
|
|
|
48
48
|
return _multiline_lit(text) if "\n" in text else _lit(text)
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
def _runs(sections: list[Section]) -> list[list[Section]]:
|
|
52
|
-
"""Group *consecutive* sections that share a
|
|
51
|
+
def _runs(sections: list[Section], *, color_of=None) -> list[list[Section]]:
|
|
52
|
+
"""Group *consecutive* sections that share a resolved colour.
|
|
53
53
|
|
|
54
54
|
Powerline draws one bar per run, so two adjacent language segments share a
|
|
55
|
-
background instead of getting an arrow between two identical colours.
|
|
55
|
+
background instead of getting an arrow between two identical colours. Grouping
|
|
56
|
+
by the *resolved* colour (override or role) means a per-section colour override
|
|
57
|
+
correctly splits a run that would otherwise share a bar — and two adjacent
|
|
58
|
+
sections overridden to the same colour still merge.
|
|
56
59
|
"""
|
|
57
60
|
runs: list[list[Section]] = []
|
|
58
61
|
for section in sections:
|
|
59
|
-
|
|
62
|
+
color = color_of(section) if color_of else section.role
|
|
63
|
+
if runs and (color_of(runs[-1][0]) if color_of else runs[-1][0].role) == color:
|
|
60
64
|
runs[-1].append(section)
|
|
61
65
|
else:
|
|
62
66
|
runs.append([section])
|
|
@@ -64,9 +68,10 @@ def _runs(sections: list[Section]) -> list[list[Section]]:
|
|
|
64
68
|
|
|
65
69
|
|
|
66
70
|
def _module_style(cfg: StarshipConfig, section: Section) -> str:
|
|
71
|
+
color = cfg.section_color(section)
|
|
67
72
|
if cfg.preset_spec.powerline:
|
|
68
|
-
return f"fg:bar_text bg:{
|
|
69
|
-
return f"fg:{
|
|
73
|
+
return f"fg:bar_text bg:{color}"
|
|
74
|
+
return f"fg:{color}"
|
|
70
75
|
|
|
71
76
|
|
|
72
77
|
def _module_format(cfg: StarshipConfig, section: Section, *, right: bool) -> str:
|
|
@@ -86,14 +91,14 @@ def _left_format(cfg: StarshipConfig, left: list[Section]) -> list[str]:
|
|
|
86
91
|
pieces: list[str] = []
|
|
87
92
|
pl = cfg.preset_spec.powerline
|
|
88
93
|
if pl and left:
|
|
89
|
-
runs = _runs(left)
|
|
90
|
-
pieces.append(f"[{pl.cap_left}](fg:{runs[0][0]
|
|
94
|
+
runs = _runs(left, color_of=cfg.section_color)
|
|
95
|
+
pieces.append(f"[{pl.cap_left}](fg:{cfg.section_color(runs[0][0])})")
|
|
91
96
|
for i, run in enumerate(runs):
|
|
92
97
|
if i:
|
|
93
|
-
prev = runs[i - 1][0]
|
|
94
|
-
pieces.append(f"[{pl.sep}](fg:{prev} bg:{run[0]
|
|
98
|
+
prev = cfg.section_color(runs[i - 1][0])
|
|
99
|
+
pieces.append(f"[{pl.sep}](fg:{prev} bg:{cfg.section_color(run[0])})")
|
|
95
100
|
pieces.extend(s.ref for s in run)
|
|
96
|
-
pieces.append(f"[{pl.sep}](fg:{runs[-1][0]
|
|
101
|
+
pieces.append(f"[{pl.sep}](fg:{cfg.section_color(runs[-1][0])})")
|
|
97
102
|
else:
|
|
98
103
|
pieces.extend(s.ref for s in left)
|
|
99
104
|
|
|
@@ -110,14 +115,14 @@ def _right_format(cfg: StarshipConfig, right: list[Section]) -> str:
|
|
|
110
115
|
if not pl:
|
|
111
116
|
return "".join(s.ref for s in right)
|
|
112
117
|
|
|
113
|
-
runs = _runs(right)
|
|
114
|
-
parts = [f"[{pl.sep_left}](fg:{runs[0][0]
|
|
118
|
+
runs = _runs(right, color_of=cfg.section_color)
|
|
119
|
+
parts = [f"[{pl.sep_left}](fg:{cfg.section_color(runs[0][0])})"]
|
|
115
120
|
for i, run in enumerate(runs):
|
|
116
121
|
if i:
|
|
117
|
-
prev = runs[i - 1][0]
|
|
118
|
-
parts.append(f"[{pl.sep_left}](fg:{run[0]
|
|
122
|
+
prev = cfg.section_color(runs[i - 1][0])
|
|
123
|
+
parts.append(f"[{pl.sep_left}](fg:{cfg.section_color(run[0])} bg:{prev})")
|
|
119
124
|
parts.extend(s.ref for s in run)
|
|
120
|
-
parts.append(f"[{pl.cap_right}](fg:{runs[-1][0]
|
|
125
|
+
parts.append(f"[{pl.cap_right}](fg:{cfg.section_color(runs[-1][0])})")
|
|
121
126
|
return "".join(parts)
|
|
122
127
|
|
|
123
128
|
|
|
@@ -197,11 +202,21 @@ def to_toml(cfg: StarshipConfig) -> str:
|
|
|
197
202
|
|
|
198
203
|
|
|
199
204
|
def _rich_color(color: str) -> str:
|
|
200
|
-
"""
|
|
201
|
-
the separator (`bright-black` vs Rich's `bright_black`)."""
|
|
205
|
+
"""A palette colour (hex or ANSI name) → Rich colour. Hex passes through; ANSI
|
|
206
|
+
names differ only in the separator (`bright-black` vs Rich's `bright_black`)."""
|
|
202
207
|
return color if color.startswith("#") else color.replace("-", "_")
|
|
203
208
|
|
|
204
209
|
|
|
210
|
+
def _resolve_for_rich(cfg: StarshipConfig, section: Section) -> str:
|
|
211
|
+
"""The Rich colour string for this section. A role name (returned by
|
|
212
|
+
``section_color`` when there is no override) is resolved through the palette;
|
|
213
|
+
a literal override (hex or ANSI name) is passed through ``_rich_color``."""
|
|
214
|
+
color = cfg.section_color(section)
|
|
215
|
+
if color in cfg.palette_spec.colors:
|
|
216
|
+
color = cfg.color(color)
|
|
217
|
+
return _rich_color(color)
|
|
218
|
+
|
|
219
|
+
|
|
205
220
|
def _sample_parts(cfg: StarshipConfig, sections: list[Section]) -> list[tuple[str, str]]:
|
|
206
221
|
"""(markup, plain text) for each rendered chunk, so the caller can measure width."""
|
|
207
222
|
parts: list[tuple[str, str]] = []
|
|
@@ -211,23 +226,23 @@ def _sample_parts(cfg: StarshipConfig, sections: list[Section]) -> list[tuple[st
|
|
|
211
226
|
pl = cfg.preset_spec.powerline
|
|
212
227
|
if pl:
|
|
213
228
|
text = _rich_color(cfg.color("bar_text"))
|
|
214
|
-
runs = _runs(sections)
|
|
215
|
-
first =
|
|
229
|
+
runs = _runs(sections, color_of=cfg.section_color)
|
|
230
|
+
first = _resolve_for_rich(cfg, runs[0][0])
|
|
216
231
|
parts.append((f"[{first}]{pl.cap_left}[/]", pl.cap_left))
|
|
217
232
|
for i, run in enumerate(runs):
|
|
218
|
-
bg =
|
|
233
|
+
bg = _resolve_for_rich(cfg, run[0])
|
|
219
234
|
if i:
|
|
220
|
-
prev =
|
|
235
|
+
prev = _resolve_for_rich(cfg, runs[i - 1][0])
|
|
221
236
|
parts.append((f"[{prev} on {bg}]{pl.sep}[/]", pl.sep))
|
|
222
237
|
for section in run:
|
|
223
238
|
body = cfg.sample_text(section)
|
|
224
239
|
parts.append((f"[{text} on {bg}] {escape(body)} [/]", f" {body} "))
|
|
225
|
-
last =
|
|
240
|
+
last = _resolve_for_rich(cfg, runs[-1][0])
|
|
226
241
|
parts.append((f"[{last}]{pl.sep}[/]", pl.sep))
|
|
227
242
|
return parts
|
|
228
243
|
|
|
229
244
|
for i, section in enumerate(sections):
|
|
230
|
-
color =
|
|
245
|
+
color = _resolve_for_rich(cfg, section)
|
|
231
246
|
body = cfg.sample_text(section)
|
|
232
247
|
prefix = "" if i == 0 else " "
|
|
233
248
|
parts.append((f"{prefix}[{color}]{escape(body)}[/]", f"{prefix}{body}"))
|
|
@@ -19,6 +19,7 @@ from rich.text import Text
|
|
|
19
19
|
|
|
20
20
|
from dev_setup import base, ui
|
|
21
21
|
from dev_setup.configure.starship import fonts
|
|
22
|
+
from dev_setup.configure.starship import icons as icon_catalog
|
|
22
23
|
from dev_setup.configure.starship import preview as live
|
|
23
24
|
from dev_setup.configure.starship.model import (
|
|
24
25
|
GROUPS,
|
|
@@ -26,6 +27,7 @@ from dev_setup.configure.starship.model import (
|
|
|
26
27
|
PALETTES,
|
|
27
28
|
PRESETS,
|
|
28
29
|
SECTIONS,
|
|
30
|
+
SECTIONS_BY_KEY,
|
|
29
31
|
StarshipConfig,
|
|
30
32
|
)
|
|
31
33
|
from dev_setup.configure.starship.render import sample_markup, to_toml
|
|
@@ -34,6 +36,64 @@ BASHRC_MARKER = "Starship prompt" # must match tools.yaml so `remove` still cle
|
|
|
34
36
|
BASHRC_LINE = 'eval "$(starship init bash)"'
|
|
35
37
|
GENERATED_HEADER = "# Starship prompt configuration"
|
|
36
38
|
|
|
39
|
+
# ---------------------------------------------------------------------------
|
|
40
|
+
# Colour and icon choices for the per-section customizers
|
|
41
|
+
# ---------------------------------------------------------------------------
|
|
42
|
+
|
|
43
|
+
# The 16 ANSI named colours starship accepts. These inherit the terminal's theme,
|
|
44
|
+
# so they are the right pick for someone who wants the prompt to track their
|
|
45
|
+
# terminal's colour scheme rather than a fixed palette.
|
|
46
|
+
_ANSI_COLORS: tuple[tuple[str, str], ...] = (
|
|
47
|
+
("black", "black"),
|
|
48
|
+
("red", "red"),
|
|
49
|
+
("green", "green"),
|
|
50
|
+
("yellow", "yellow"),
|
|
51
|
+
("blue", "blue"),
|
|
52
|
+
("purple", "magenta"),
|
|
53
|
+
("cyan", "cyan"),
|
|
54
|
+
("white", "white"),
|
|
55
|
+
("bright-black", "bright-black"),
|
|
56
|
+
("bright-red", "bright-red"),
|
|
57
|
+
("bright-green", "bright-green"),
|
|
58
|
+
("bright-yellow", "bright-yellow"),
|
|
59
|
+
("bright-blue", "bright-blue"),
|
|
60
|
+
("bright-magenta", "bright-magenta"),
|
|
61
|
+
("bright-cyan", "bright-cyan"),
|
|
62
|
+
("bright-white", "bright-white"),
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
# A curated spread of hex colours — enough to find something close to any taste
|
|
66
|
+
# without overwhelming the list. These are the same families the built-in palettes
|
|
67
|
+
# draw from, so they sit well next to them.
|
|
68
|
+
_HEX_COLORS: tuple[tuple[str, str], ...] = (
|
|
69
|
+
("#f38ba8", "Red (soft)"),
|
|
70
|
+
("#fb4934", "Red (bright)"),
|
|
71
|
+
("#ff5555", "Red (vivid)"),
|
|
72
|
+
("#fabd2f", "Yellow (warm)"),
|
|
73
|
+
("#e0af68", "Yellow (muted)"),
|
|
74
|
+
("#f9e2af", "Yellow (soft)"),
|
|
75
|
+
("#a6e3a1", "Green (soft)"),
|
|
76
|
+
("#b8bb26", "Green (warm)"),
|
|
77
|
+
("#50fa7b", "Green (vivid)"),
|
|
78
|
+
("#89b4fa", "Blue (soft)"),
|
|
79
|
+
("#7aa2f7", "Blue (muted)"),
|
|
80
|
+
("#1e66f5", "Blue (saturated)"),
|
|
81
|
+
("#cba6f7", "Purple (soft)"),
|
|
82
|
+
("#bb9af7", "Purple (muted)"),
|
|
83
|
+
("#ff79c6", "Pink (vivid)"),
|
|
84
|
+
("#ebbcba", "Pink (soft)"),
|
|
85
|
+
("#94e2d5", "Teal (soft)"),
|
|
86
|
+
("#7dcfff", "Cyan (vivid)"),
|
|
87
|
+
("#88c0d0", "Cyan (muted)"),
|
|
88
|
+
("#f5c2e7", "Mauve"),
|
|
89
|
+
("#f9e2af", "Cream"),
|
|
90
|
+
("#6c7086", "Grey (dark)"),
|
|
91
|
+
("#9399b2", "Grey (light)"),
|
|
92
|
+
("#cdd6f4", "Off-white"),
|
|
93
|
+
("#1e1e2e", "Dark surface"),
|
|
94
|
+
("#eff1f5", "Light surface"),
|
|
95
|
+
)
|
|
96
|
+
|
|
37
97
|
|
|
38
98
|
def default_config_path() -> Path:
|
|
39
99
|
return Path.home() / ".config" / "starship.toml"
|
|
@@ -183,6 +243,249 @@ def _ask_sections(cfg: StarshipConfig) -> list[str]:
|
|
|
183
243
|
return list(selected)
|
|
184
244
|
|
|
185
245
|
|
|
246
|
+
# ---------------------------------------------------------------------------
|
|
247
|
+
# Per-section colour and icon customizers
|
|
248
|
+
# ---------------------------------------------------------------------------
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
def _swatch(color: str, text: str, *, pad: int = 2) -> list[tuple[str, str]]:
|
|
252
|
+
"""A prompt_toolkit formatted title: a coloured block followed by text.
|
|
253
|
+
|
|
254
|
+
The block uses inline ``bg:``/``fg:`` styles so it renders as a real swatch in
|
|
255
|
+
any terminal that supports 256 colours. Hex and ANSI names both work as
|
|
256
|
+
prompt_toolkit colour values."""
|
|
257
|
+
fg = "#1e1e2e" if _is_light(color) else "#eff1f5"
|
|
258
|
+
return [(f"bg:{color} fg:{fg}", " " * pad), ("class:text", f" {text}")]
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def _is_light(color: str) -> bool:
|
|
262
|
+
"""Rough luminance check for swatch text contrast — light backgrounds get dark
|
|
263
|
+
text, dark ones get light. Good enough for a swatch; not a colour science tool."""
|
|
264
|
+
hex_color = _ANSI_TO_HEX.get(color, color)
|
|
265
|
+
if not hex_color.startswith("#") or len(hex_color) != 7:
|
|
266
|
+
return False
|
|
267
|
+
r, g, b = int(hex_color[1:3], 16), int(hex_color[3:5], 16), int(hex_color[5:7], 16)
|
|
268
|
+
# Perceived luminance — the ITU-R BT.601 weighting.
|
|
269
|
+
return (0.299 * r + 0.587 * g + 0.114 * b) / 255 > 0.5
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
# Approximate hex values for the 8 basic ANSI colours, for swatch contrast only.
|
|
273
|
+
# `bright-*` variants are not mapped here; they default to the dark-text path,
|
|
274
|
+
# which is readable on every common terminal theme's bright colours.
|
|
275
|
+
_ANSI_TO_HEX: dict[str, str] = {
|
|
276
|
+
"black": "#000000", "red": "#cc0400", "green": "#19b400",
|
|
277
|
+
"yellow": "#cdcd00", "blue": "#0042cc", "purple": "#cc00cc",
|
|
278
|
+
"magenta": "#cc00cc", "cyan": "#00cccc", "white": "#cccccc",
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
def _ask_colors(cfg: StarshipConfig) -> None:
|
|
283
|
+
"""The per-section colour customizer. Mutates ``cfg.color_overrides`` in place."""
|
|
284
|
+
selected = cfg.selected()
|
|
285
|
+
if not selected:
|
|
286
|
+
ui.warn("No sections selected — pick sections first.")
|
|
287
|
+
return
|
|
288
|
+
|
|
289
|
+
while True:
|
|
290
|
+
# Step 1: pick a section to recolour.
|
|
291
|
+
section_choices: list = []
|
|
292
|
+
for section in selected:
|
|
293
|
+
label = section.label
|
|
294
|
+
if section.key in cfg.color_overrides:
|
|
295
|
+
label += " (custom)"
|
|
296
|
+
section_choices.append(questionary.Choice(
|
|
297
|
+
title=_swatch(_resolve_swatch_color(cfg, section), label),
|
|
298
|
+
value=section.key,
|
|
299
|
+
))
|
|
300
|
+
section_choices.append(questionary.Separator())
|
|
301
|
+
section_choices.append(questionary.Choice(title="Done", value="__done__"))
|
|
302
|
+
picked = _select("Section to recolour:", section_choices, "__done__")
|
|
303
|
+
if picked == "__done__" or not picked:
|
|
304
|
+
return
|
|
305
|
+
|
|
306
|
+
section = SECTIONS_BY_KEY[picked]
|
|
307
|
+
current = cfg.section_color(section)
|
|
308
|
+
current_label = current if current.startswith("#") else current
|
|
309
|
+
if section.key not in cfg.color_overrides:
|
|
310
|
+
current_label += " (palette default)"
|
|
311
|
+
|
|
312
|
+
# Step 2: pick a colour for that section.
|
|
313
|
+
color_choices: list = [
|
|
314
|
+
questionary.Choice(
|
|
315
|
+
title=_swatch(cfg.color(section.role), f"Reset to palette ({section.role})"),
|
|
316
|
+
value="__reset__",
|
|
317
|
+
),
|
|
318
|
+
questionary.Separator("\n ANSI (terminal theme)"),
|
|
319
|
+
]
|
|
320
|
+
for value, label in _ANSI_COLORS:
|
|
321
|
+
color_choices.append(questionary.Choice(
|
|
322
|
+
title=_swatch(value, label), value=value,
|
|
323
|
+
description=current_label if value == current else "",
|
|
324
|
+
))
|
|
325
|
+
color_choices.append(questionary.Separator("\n Hex"))
|
|
326
|
+
for value, label in _HEX_COLORS:
|
|
327
|
+
color_choices.append(questionary.Choice(
|
|
328
|
+
title=_swatch(value, label), value=value,
|
|
329
|
+
description=current_label if value == current else "",
|
|
330
|
+
))
|
|
331
|
+
color_choices.append(questionary.Separator())
|
|
332
|
+
color_choices.append(questionary.Choice(title="Custom hex…", value="__custom__"))
|
|
333
|
+
|
|
334
|
+
chosen = _select(f"Colour for {section.label}:", color_choices, "__reset__")
|
|
335
|
+
if chosen == "__custom__":
|
|
336
|
+
hex_default = current if current.startswith("#") else ""
|
|
337
|
+
hex_input = ui.text_input("Hex colour (e.g. #89b4fa):", default=hex_default)
|
|
338
|
+
if hex_input.strip():
|
|
339
|
+
cfg.color_overrides[section.key] = hex_input.strip()
|
|
340
|
+
elif chosen == "__reset__" or not chosen:
|
|
341
|
+
cfg.color_overrides.pop(section.key, None)
|
|
342
|
+
else:
|
|
343
|
+
cfg.color_overrides[section.key] = chosen
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
def _resolve_swatch_color(cfg: StarshipConfig, section) -> str:
|
|
347
|
+
"""The hex/ANSI colour for a section's swatch — resolves a role name through
|
|
348
|
+
the palette so the swatch matches what the prompt will actually draw."""
|
|
349
|
+
color = cfg.section_color(section)
|
|
350
|
+
if color in cfg.palette_spec.colors:
|
|
351
|
+
color = cfg.color(color)
|
|
352
|
+
return color
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
def _font_note() -> None:
|
|
356
|
+
"""A one-time note about where the font needs to be, shown at the top of the
|
|
357
|
+
icon picker. Over SSH the glyphs are drawn by the client's terminal, so a
|
|
358
|
+
Nerd Font installed here would never be used — the user needs to know that
|
|
359
|
+
before they stare at a list of boxes wondering what went wrong."""
|
|
360
|
+
if fonts.is_remote_session():
|
|
361
|
+
ui.console.print()
|
|
362
|
+
ui.warn("You are over SSH — icons render on the client, not here.")
|
|
363
|
+
ui.dim(f" Install a Nerd Font on the machine your terminal runs on: {fonts.NERD_FONT_URL}")
|
|
364
|
+
ui.dim(" and set that terminal's font to it. The glyphs below will show as")
|
|
365
|
+
ui.dim(" boxes until then, but the choices still work once the font is in place.")
|
|
366
|
+
elif fonts.detect() is False:
|
|
367
|
+
ui.console.print()
|
|
368
|
+
ui.warn("No Nerd Font found — icons below will show as boxes.")
|
|
369
|
+
ui.dim(f" Install one: devstuff install {fonts.NERD_FONT_KEY} · {fonts.NERD_FONT_URL}")
|
|
370
|
+
ui.dim(" The choices still work once the font is installed and your terminal")
|
|
371
|
+
ui.dim(" is set to use it.")
|
|
372
|
+
# detect() is True → say nothing; the picker just works.
|
|
373
|
+
# detect() is None → fontconfig unavailable; guessing wrong would be worse
|
|
374
|
+
# than silence, so stay quiet (mirrors _FontGate's reasoning).
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
def _ask_icons(cfg: StarshipConfig) -> None:
|
|
378
|
+
"""The per-section icon customizer. Mutates ``cfg.icon_overrides`` in place."""
|
|
379
|
+
selected = [s for s in cfg.selected() if s.takes_symbol]
|
|
380
|
+
if not selected:
|
|
381
|
+
ui.warn("No icon-bearing sections selected.")
|
|
382
|
+
return
|
|
383
|
+
|
|
384
|
+
_font_note()
|
|
385
|
+
while True:
|
|
386
|
+
# Step 1: pick a section to re-icon.
|
|
387
|
+
section_choices: list = []
|
|
388
|
+
for section in selected:
|
|
389
|
+
glyph = cfg.symbol(section)
|
|
390
|
+
label = section.label
|
|
391
|
+
if section.key in cfg.icon_overrides:
|
|
392
|
+
label += " (custom)"
|
|
393
|
+
section_choices.append(questionary.Choice(
|
|
394
|
+
title=[("class:text", f" {glyph} "),
|
|
395
|
+
("class:text", label)],
|
|
396
|
+
value=section.key,
|
|
397
|
+
))
|
|
398
|
+
section_choices.append(questionary.Separator())
|
|
399
|
+
section_choices.append(questionary.Choice(title="Done", value="__done__"))
|
|
400
|
+
picked = _select("Section to re-icon:", section_choices, "__done__")
|
|
401
|
+
if picked == "__done__" or not picked:
|
|
402
|
+
return
|
|
403
|
+
|
|
404
|
+
section = SECTIONS_BY_KEY[picked]
|
|
405
|
+
current_glyph = cfg.symbol(section)
|
|
406
|
+
|
|
407
|
+
# Step 2: pick an icon — a rendered, grouped select with a search fallback.
|
|
408
|
+
chosen = _pick_icon(section, current_glyph)
|
|
409
|
+
if chosen is None:
|
|
410
|
+
continue # cancelled the search, back to section picker
|
|
411
|
+
if chosen == "__reset__":
|
|
412
|
+
cfg.icon_overrides.pop(section.key, None)
|
|
413
|
+
else:
|
|
414
|
+
cfg.icon_overrides[section.key] = chosen
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
def _pick_icon(section, current_glyph: str) -> str | None:
|
|
418
|
+
"""The icon picker: a rendered, grouped select with a filterable search fallback.
|
|
419
|
+
|
|
420
|
+
Returns the chosen glyph string, ``"__reset__"`` to clear an override, or None
|
|
421
|
+
if the user backed out of both the select and the search."""
|
|
422
|
+
# Find the current icon in the catalog so we can auto-select it.
|
|
423
|
+
current_icon = icon_catalog.find_icon_by_glyph(current_glyph)
|
|
424
|
+
default_key = current_icon.key if current_icon else None
|
|
425
|
+
|
|
426
|
+
choices: list = [
|
|
427
|
+
questionary.Choice(
|
|
428
|
+
title=[("class:text", f" {current_glyph} "),
|
|
429
|
+
("class:instruction", f"Reset to default ({section.plain or 'icon'})")],
|
|
430
|
+
value="__reset__",
|
|
431
|
+
),
|
|
432
|
+
questionary.Separator(),
|
|
433
|
+
questionary.Choice(
|
|
434
|
+
title=[("class:instruction", "Search icons…")],
|
|
435
|
+
value="__search__",
|
|
436
|
+
),
|
|
437
|
+
questionary.Separator(),
|
|
438
|
+
]
|
|
439
|
+
for cat in icon_catalog.ICON_CATEGORIES:
|
|
440
|
+
entries = icon_catalog.icons_by_category().get(cat, [])
|
|
441
|
+
if not entries:
|
|
442
|
+
continue
|
|
443
|
+
choices.append(questionary.Separator(f"\n {cat.upper()}"))
|
|
444
|
+
for icon in entries:
|
|
445
|
+
marker = " (current)" if icon.key == default_key else ""
|
|
446
|
+
choices.append(questionary.Choice(
|
|
447
|
+
title=[("class:text", f" {icon.glyph} "),
|
|
448
|
+
("class:text", icon.label),
|
|
449
|
+
("class:instruction", marker)],
|
|
450
|
+
value=icon.glyph,
|
|
451
|
+
))
|
|
452
|
+
choices.append(questionary.Separator())
|
|
453
|
+
choices.append(questionary.Choice(
|
|
454
|
+
title=[("class:instruction", "Custom…")],
|
|
455
|
+
value="__custom__",
|
|
456
|
+
))
|
|
457
|
+
|
|
458
|
+
picked = _select(f"Icon for {section.label}:", choices, "__reset__")
|
|
459
|
+
if picked == "__search__":
|
|
460
|
+
return _search_icon(current_glyph)
|
|
461
|
+
if picked == "__custom__":
|
|
462
|
+
custom = ui.text_input("Custom icon text:", default=current_glyph.strip())
|
|
463
|
+
return custom + " " if custom and not custom.endswith(" ") else custom or None
|
|
464
|
+
return picked or "__reset__"
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
def _search_icon(current_glyph: str) -> str | None:
|
|
468
|
+
"""The filterable icon search — autocomplete over the catalog's labels.
|
|
469
|
+
|
|
470
|
+
Returns the chosen glyph, or None if the user pressed Enter on empty input
|
|
471
|
+
(meaning "keep the current icon, go back to the section picker")."""
|
|
472
|
+
labels = [icon.label for icon in icon_catalog.ICONS]
|
|
473
|
+
meta = {icon.label: f"{icon.glyph} · {' / '.join(icon.categories)}" for icon in icon_catalog.ICONS}
|
|
474
|
+
result = ui.autocomplete(
|
|
475
|
+
"Search icons (type to filter, Enter to pick):",
|
|
476
|
+
choices=labels,
|
|
477
|
+
meta_information=meta,
|
|
478
|
+
)
|
|
479
|
+
if not result:
|
|
480
|
+
return None # empty — keep current, back to section picker
|
|
481
|
+
# Map the label back to the glyph; if it doesn't match a known label, treat
|
|
482
|
+
# the typed text as a custom icon.
|
|
483
|
+
for icon in icon_catalog.ICONS:
|
|
484
|
+
if icon.label == result:
|
|
485
|
+
return icon.glyph
|
|
486
|
+
return result
|
|
487
|
+
|
|
488
|
+
|
|
186
489
|
def _select(prompt: str, choices: list, current: str) -> str:
|
|
187
490
|
"""A select whose cursor starts on the current value, so revisiting a step from
|
|
188
491
|
the review menu shows what is already chosen."""
|
|
@@ -294,6 +597,8 @@ _MENU = {
|
|
|
294
597
|
"style": "Change the prompt style",
|
|
295
598
|
"palette": "Change the colour palette",
|
|
296
599
|
"sections": "Change which sections show",
|
|
600
|
+
"colors": "Customize section colours",
|
|
601
|
+
"icons": "Customize section icons",
|
|
297
602
|
"layout": "Change the layout",
|
|
298
603
|
"versions": "Toggle language version numbers",
|
|
299
604
|
"spacing": "Toggle the blank line between prompts",
|
|
@@ -351,6 +656,10 @@ def run(*, target: Path | None = None) -> StarshipConfig | None:
|
|
|
351
656
|
cfg.palette = _ask_palette(cfg)
|
|
352
657
|
elif action == "sections":
|
|
353
658
|
cfg.sections = _ask_sections(cfg)
|
|
659
|
+
elif action == "colors":
|
|
660
|
+
_ask_colors(cfg)
|
|
661
|
+
elif action == "icons":
|
|
662
|
+
_ask_icons(cfg)
|
|
354
663
|
elif action == "layout":
|
|
355
664
|
cfg.layout = _ask_layout(cfg)
|
|
356
665
|
elif action == "versions":
|
dev_setup/ui.py
CHANGED
|
@@ -207,6 +207,15 @@ def checkbox(prompt: str, choices: list, **kwargs) -> list:
|
|
|
207
207
|
return result or []
|
|
208
208
|
|
|
209
209
|
|
|
210
|
+
def autocomplete(prompt: str, choices: list, **kwargs) -> str:
|
|
211
|
+
"""A filterable text prompt. As the user types, the list narrows to matching
|
|
212
|
+
choices; Enter returns whatever is in the input buffer (a selected choice or
|
|
213
|
+
the typed text). ``choices`` are plain strings; ``meta_information`` is a
|
|
214
|
+
dict mapping choice → description shown for the highlighted row."""
|
|
215
|
+
result = _ask(questionary.autocomplete(prompt, choices=choices, style=_STYLE, **kwargs))
|
|
216
|
+
return result or ""
|
|
217
|
+
|
|
218
|
+
|
|
210
219
|
def password(prompt: str) -> str:
|
|
211
220
|
result = _ask(questionary.password(prompt, style=_STYLE))
|
|
212
221
|
return result or ""
|
|
@@ -18,7 +18,7 @@ dev_setup/links_catalog.py,sha256=Xe7s9oqiCrfQPUwE-X9o6p5VkU7mH9PjY9NMyn6VbHg,46
|
|
|
18
18
|
dev_setup/links_registry.py,sha256=xyq49oH1u_CX85UcizKSuxuy_pzurNoDwSRg3YftUMY,2439
|
|
19
19
|
dev_setup/registry.py,sha256=8lrk6EXCCWk1WNeNnCGLTJ-v8rpCs7-TLYtVXgiuxnA,2243
|
|
20
20
|
dev_setup/tools.yaml,sha256=m2MEYq_mZuzEU8vCJgPWHdhLuqRjQGNWheqhwQgMXXQ,34234
|
|
21
|
-
dev_setup/ui.py,sha256=
|
|
21
|
+
dev_setup/ui.py,sha256=bm4VBv-DVs8h7v6roHUNQ7TqmUoXcBRNu78Xex-Qx-0,7505
|
|
22
22
|
dev_setup/verbose.py,sha256=N3U9JAYOvFwdd8DT6W7Pqq6RCIUfbcQnPsm0O1TnvQY,5003
|
|
23
23
|
dev_setup/agent/__init__.py,sha256=znrgxUCr_y0Qp-f41S6EaTv-hoTYwoZ9mOMLVge-IJg,226
|
|
24
24
|
dev_setup/agent/approval.py,sha256=DNPV5iM_UpCx39xFzCu8kyr03tjfyfD7iVcTfQMJRwY,3630
|
|
@@ -93,11 +93,12 @@ dev_setup/configure/reptyr/__init__.py,sha256=uiG0Ti-YUUSOEFURVz4OLQIRzIoqXJnQmr
|
|
|
93
93
|
dev_setup/configure/reptyr/wizard.py,sha256=xuevKazv3_uSnd4r6kPWgATMHslDwv1uZsTqPyAdRC0,5779
|
|
94
94
|
dev_setup/configure/starship/__init__.py,sha256=UfQMwrHVSXjsEwiHQrPNoAlUloxI3pZUUJEuRjg3O9I,77
|
|
95
95
|
dev_setup/configure/starship/fonts.py,sha256=CiZ9kXe8-AySuUxZmxMQkHqx7RAGzIu8fclqZDxs9qo,1733
|
|
96
|
-
dev_setup/configure/starship/
|
|
96
|
+
dev_setup/configure/starship/icons.py,sha256=6DX4FsV3s-C4HdA1IvtmkZbV2VpLsbYXRCFTWPi9PVc,10597
|
|
97
|
+
dev_setup/configure/starship/model.py,sha256=ct1YrR3xLqcKMP20TvKZQ0Oc-OxHMrRjneipzo4tOuM,28429
|
|
97
98
|
dev_setup/configure/starship/preview.py,sha256=ZaNhNA3AeHHtPnMqrJbB9XVVXDFbH1R36jm8xyYdt2U,6145
|
|
98
|
-
dev_setup/configure/starship/render.py,sha256=
|
|
99
|
-
dev_setup/configure/starship/wizard.py,sha256=
|
|
100
|
-
devstuff-2.
|
|
101
|
-
devstuff-2.
|
|
102
|
-
devstuff-2.
|
|
103
|
-
devstuff-2.
|
|
99
|
+
dev_setup/configure/starship/render.py,sha256=25O8w4IteVd_ELwmIWhcYAn042W6yZ--zbTMcJpzVJc,11277
|
|
100
|
+
dev_setup/configure/starship/wizard.py,sha256=Q6aoKnz_n9WhFhTD4EygvaenZRsQTVwyZ1ga-cpUqBk,28620
|
|
101
|
+
devstuff-2.10.0.dist-info/METADATA,sha256=mq5FgOs4AL55d3uf1EpTwazxTrBlPvUlYHUrdzDVfp8,77776
|
|
102
|
+
devstuff-2.10.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
103
|
+
devstuff-2.10.0.dist-info/entry_points.txt,sha256=48ITy9ENdXDFrTHwAyVPUpq1MDmgFqcOisOo5mAR6OQ,53
|
|
104
|
+
devstuff-2.10.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|