repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

fix nushell secret bootstrap

a0076861e396e80c24a624787cdcbf78c28fc360

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (16)

.gitignore

Modified
18 18 nushell/history.sqlite3*
19 19 nushell/plugin.nu
20 20 nushell/aliases.nu
21 -nushell/secrets.nuon
22 -nushell/secrets.nu
24 22 chawan/history.uri

.secrets

Modified
10 10 ssh/bugabinga.net.key
11 11 gh/hosts.yml
12 12 pi/agent/auth.json
13 +nushell/secrets.nu

NB-00718.symlinks

Modified
25 25 nushell/gen-aliases.nu
26 26 ~/AppData/Roaming/nushell/gen-aliases.nu
28 -nushell/gen-secrets.nu
29 -~/AppData/Roaming/nushell/gen-secrets.nu
28 +nushell/secrets.nu
29 +~/AppData/Roaming/nushell/secrets.nu
31 31 bat/config
32 32 ~/AppData/Roaming/bat/config

bootstripper.java

Modified
66 66 check(root);
67 67 return;
69 + if ("pre-commit".equals(command)) {
70 + setup_crypto(root, false);
71 + pre_commit(root);
72 + return;
73 + }
74 + if ("install-hooks".equals(command)) {
75 + require_git_repo(root);
76 + require_normal_gitdir(root);
77 + install_hooks(root);
78 + return;
79 + }
70 81 log("Assuming dorkfiles root repo in {0}.", emphasize_local(root.toString()));
71 82 if ("clean".equals(command)) {
77 88 setup_crypto(root, true);
89 + install_hooks(root);
78 90 check(root);
79 91 var symlinks_file = symlinks_file(root);
80 92 create_symlinks(root, symlinks_file);
83 95 static boolean is_command(String argument) {
84 - return "bootstrap".equals(argument) || "clean".equals(argument) || "check".equals(argument) || "init-crypto".equals(argument);
96 + return "bootstrap".equals(argument) || "clean".equals(argument) || "check".equals(argument) || "pre-commit".equals(argument) || "install-hooks".equals(argument) || "init-crypto".equals(argument);
87 99 static void init_crypto(Path root) throws Throwable {
110 122 if (restore)
111 123 restore_tracked_secrets(root, secrets);
112 124 apply_secret_permissions(root, secrets);
113 - install_pre_commit_hook(root);
116 127 static void require_git_repo(Path root) throws Throwable {
224 235 static void restore_tracked_secrets(Path root, List<String> secrets) throws Throwable {
225 236 var tracked = new ArrayList<String>();
226 237 for (var secret : secrets) {
227 - var result = run(root, List.of("git", "ls-files", "--error-unmatch", "--", secret), null, false, false);
238 + var result = run(root, List.of("git", "cat-file", "-e", "HEAD:" + secret), null, false, false);
228 239 if (result.exit == 0) {
229 240 tracked.add(secret);
230 241 var path = root.resolve(secret);
251 - static void install_pre_commit_hook(Path root) throws IOException {
262 + static void install_hooks(Path root) throws IOException {
252 263 var hooks = root.resolve(".git/hooks");
253 264 Files.createDirectories(hooks);
254 265 var hook = hooks.resolve("pre-commit");
255 - Files.writeString(hook, "#!/bin/sh\ncd \"$(git rev-parse --show-toplevel)\" || exit 1\nexec java bootstripper.java check\n", StandardCharsets.UTF_8);
266 + Files.writeString(hook, "#!/bin/sh\ncd \"$(git rev-parse --show-toplevel)\" || exit 1\nexec java bootstripper.java pre-commit\n", StandardCharsets.UTF_8);
256 267 chmod(hook, "rwxr-xr-x");
268 + log("Installed Git hook: {0}", emphasize_local(".git/hooks/pre-commit"));
271 + static void pre_commit(Path root) throws Throwable {
272 + check(root);
273 + run_optional_gitleaks(root);
276 + static void run_optional_gitleaks(Path root) throws Throwable {
277 + try {
278 + run(root, List.of("gitleaks", "git", "--pre-commit", "--staged", "--redact=100"), null, true);
279 + } catch (IOException error) {
280 + if (error.getMessage() != null && error.getMessage().contains("Cannot run program \"gitleaks\"")) {
281 + log("Skipping gitleaks: command not found.");
282 + return;
284 + throw error;
259 288 static void check(Path root) throws Throwable {
264 293 check_attributes(root, secrets);
265 294 check_key_not_tracked(root);
266 295 check_staged_secrets(root, secrets);
296 + check_symlink_sources(root);
267 297 check_no_tresor_refs(root);
268 298 check_staged_plaintext_patterns(root);
269 299 log("OK bootstripper check passed.");
347 + static void check_symlink_sources(Path root) throws Throwable {
348 + try (var stream = Files.list(root)) {
349 + var files = stream.filter(path -> path.getFileName().toString().endsWith(".symlinks")).collect(Collectors.toList());
350 + for (var file : files) {
351 + var lines = Files.readAllLines(file);
352 + String source = null;
353 + var line_number = 0;
354 + for (var raw : lines) {
355 + line_number++;
356 + var line = raw.strip();
357 + if (line.isEmpty())
358 + continue;
359 + if (source == null) {
360 + source = line;
361 + continue;
363 + var source_path = root.resolve(source);
364 + if (!Files.exists(source_path, LinkOption.NOFOLLOW_LINKS))
365 + throw fail("Missing symlink source: {0}:{1}: {2}", file.getFileName(), line_number - 1, source);
366 + source = null;
368 + if (source != null)
369 + throw fail("Missing symlink target after: {0}: {1}", file.getFileName(), source);
317 374 static void check_no_tresor_refs(Path root) throws IOException {
318 375 try (var stream = Files.list(root)) {
319 376 var files = stream.filter(path -> path.getFileName().toString().endsWith(".symlinks")).collect(Collectors.toList());
338 395 for (var pattern : patterns) {
339 396 var matcher = pattern.matcher(diff);
340 397 if (matcher.find())
341 - throw fail("Potential plaintext secret in staged diff: {0}", matcher.group());
398 + throw fail("Potential plaintext secret in staged diff.");
461 518 static void usage() {
462 519 log("Bootstraps bugabingas {0}.", emphasize_local("dorkfiles"));
463 - log("{0}: java bootstripper.java [init-crypto|check|clean] [dotfiles root path]", emphasize_global("Usage"));
520 + log("{0}: java bootstripper.java [init-crypto|check|pre-commit|install-hooks|clean] [dotfiles root path]", emphasize_global("Usage"));
466 523 static String emphasize_global(String message) {

desktop.symlinks

Modified
79 79 nushell/gen-aliases.nu
80 80 ~/.config/nushell/gen-aliases.nu
82 -nushell/gen-secrets.nu
83 -~/.config/nushell/gen-secrets.nu
82 +nushell/secrets.nu
83 +~/.config/nushell/secrets.nu
85 85 nushell/modules
86 86 ~/.config/nushell/modules

fedora.symlinks

Modified
73 73 nushell/gen-aliases.nu
74 74 ~/.config/nushell/gen-aliases.nu
76 -nushell/gen-secrets.nu
77 -~/.config/nushell/gen-secrets.nu
76 +nushell/secrets.nu
77 +~/.config/nushell/secrets.nu
79 79 nushell/modules
80 80 ~/.config/nushell/modules
118 118 pueue/pueued.service
119 119 ~/.config/systemd/user/pueued.service
121 -firefox/profiles.ini
122 -~/.mozilla/firefox/profiles.ini
124 -firefox/qrza8u52.default-release/user.js
125 -~/.mozilla/firefox/qrza8u52.default-release/user.js
127 121 psd/psd.conf
128 122 ~/.config/psd/psd.conf

justfile

Modified
3 3 set shell := ["nu", "--commands"]
5 5 default:
6 6 @just --list
8 -# link dorkfiles into HOME
8 +# initialize crypto, install hooks, verify, link dorkfiles into HOME
9 9 link:
10 - java bootstripper.java
10 + java bootstripper.java bootstrap
12 +# verify crypto filters, hooks, and staged secrets
13 +check:
14 + java bootstripper.java check
16 +# run the same checks as the Git pre-commit hook
17 +pre-commit:
18 + java bootstripper.java pre-commit
20 +# integration test in ephemeral rootless Podman Linux; fresh system deps: git + java
21 +# tests every *.symlinks manifest; primary hostname printed first for quick failure context
22 +test hostname="desktop":
23 + #!/usr/bin/env bash
24 + set -euo pipefail
26 + root="$(git rev-parse --show-toplevel)"
27 + key="$root/.git/dotfiles-aes.key"
28 + image="registry.fedoraproject.org/fedora:latest"
29 + container="dotfiles-integration-$(date +%Y%m%d%H%M%S)-$$"
31 + if [ ! -r "$key" ]; then
32 + echo "missing $key"
33 + exit 1
34 + fi
36 + trap 'podman rm -f "$container" >/dev/null 2>&1 || true' EXIT
38 + echo "container=$container"
39 + podman run --name "$container" --rm -i --hostname "{{hostname}}" \
40 + -e PRIMARY_HOSTNAME="{{hostname}}" \
41 + -v "$root:/src:ro" \
42 + -v "$key:/dotfiles-aes.key:ro" \
43 + "$image" bash -s <<'CONTAINER'
44 + set -euo pipefail
46 + ok() { echo "ok:$1"; }
47 + fail() { echo "FAIL:$1"; exit 1; }
49 + target_path() {
50 + local home="$1"
51 + local target="$2"
52 + if [[ "$target" == ~* ]]; then
53 + printf '%s%s\n' "$home" "${target:1}"
54 + else
55 + printf '%s\n' "$target"
56 + fi
57 + }
59 + targets_for() {
60 + awk '
61 + { sub(/\r$/, "") }
62 + NF == 0 { next }
63 + source == "" { source = $0; next }
64 + { print $0; source = "" }
65 + END { if (source != "") exit 2 }
66 + ' "$1"
67 + }
69 + run_manifest() {
70 + local host="$1"
71 + local manifest="$host.symlinks"
72 + local home="/tmp/home-$host"
73 + local bootstrap_log="/tmp/bootstrap-$host.log"
74 + local check_log="/tmp/check-$host.log"
75 + local clean_log="/tmp/clean-$host.log"
77 + echo "manifest=$manifest"
78 + rm -rf "$home"
79 + mkdir -p "$home"
81 + HOSTNAME="$host" java -Duser.home="$home" bootstripper.java bootstrap >"$bootstrap_log" 2>&1 || {
82 + echo "FAIL:bootstrap:$host"
83 + tail -120 "$bootstrap_log"
84 + exit 1
85 + }
86 + ok "bootstrap:$host"
88 + HOSTNAME="$host" java -Duser.home="$home" bootstripper.java check >"$check_log" 2>&1 || {
89 + echo "FAIL:check:$host"
90 + cat "$check_log"
91 + exit 1
92 + }
93 + ok "check:$host"
95 + while IFS= read -r target; do
96 + local path
97 + path="$(target_path "$home" "$target")"
98 + test -L "$path" || fail "link:$host:$target"
99 + done < <(targets_for "$manifest")
100 + ok "links:$host"
102 + HOSTNAME="$host" java -Duser.home="$home" bootstripper.java clean >"$clean_log" 2>&1 || {
103 + echo "FAIL:clean:$host"
104 + cat "$clean_log"
105 + exit 1
107 + ok "clean:$host"
110 + fresh_crypto_smoke() {
111 + local repo=/tmp/fresh-crypto
112 + rm -rf "$repo" /tmp/fresh-crypto-home
113 + mkdir -p "$repo/tools" /tmp/fresh-crypto-home
114 + cp bootstripper.java "$repo/"
115 + cp tools/aes.java "$repo/tools/"
116 + cd "$repo"
117 + git init --quiet
118 + printf 'secret.txt\n' > .secrets
119 + printf 'dummy.txt\n~/dummy.txt\n' > mini.symlinks
120 + printf 'not a real secret\n' > secret.txt
121 + printf 'dummy\n' > dummy.txt
123 + DOTFILES_AES_PASSPHRASE=test java bootstripper.java init-crypto >/tmp/fresh-init.log 2>&1 || { cat /tmp/fresh-init.log; fail fresh-init; }
124 + DOTFILES_AES_PASSPHRASE=test java bootstripper.java check >/tmp/fresh-check-1.log 2>&1 || { cat /tmp/fresh-check-1.log; fail fresh-check-1; }
125 + git add .dotfiles-aes-salt .secrets bootstripper.java tools/aes.java mini.symlinks dummy.txt secret.txt
126 + DOTFILES_AES_PASSPHRASE=test java bootstripper.java check >/tmp/fresh-check-2.log 2>&1 || { cat /tmp/fresh-check-2.log; fail fresh-check-2; }
127 + git show :secret.txt | head -c 6 | grep -qx DFAES1 || fail fresh-staged-encrypted
128 + HOSTNAME=mini DOTFILES_AES_PASSPHRASE=test java -Duser.home=/tmp/fresh-crypto-home bootstripper.java bootstrap >/tmp/fresh-bootstrap.log 2>&1 || { cat /tmp/fresh-bootstrap.log; fail fresh-bootstrap; }
129 + test -L /tmp/fresh-crypto-home/dummy.txt || fail fresh-link
130 + HOSTNAME=mini DOTFILES_AES_PASSPHRASE=test java -Duser.home=/tmp/fresh-crypto-home bootstripper.java clean >/tmp/fresh-clean.log 2>&1 || { cat /tmp/fresh-clean.log; fail fresh-clean; }
131 + ok fresh-crypto
134 + printf 'rootless='
135 + awk 'NR == 1 { print ($1 == 0 && $2 != 0) ? "yes" : "unknown" }' /proc/self/uid_map
137 + if ! dnf -qy --setopt=install_weak_deps=False install git-core java-latest-openjdk-headless >/tmp/dnf.log 2>&1; then
138 + cat /tmp/dnf.log
139 + fail deps
140 + fi
141 + ok deps
142 + git --version
143 + java -version 2>&1 | sed -n '1p'
145 + mkdir -p /root/work
146 + git config --global --add safe.directory /src
147 + git clone --quiet --no-local /src /root/work/dotfiles || fail clone
148 + install -m 600 /dotfiles-aes.key /root/work/dotfiles/.git/dotfiles-aes.key
149 + cd /root/work/dotfiles
151 + java bootstripper.java install-hooks >/tmp/install-hooks.log 2>&1 || { cat /tmp/install-hooks.log; fail install-hooks; }
152 + test -x .git/hooks/pre-commit || fail hook-executable
153 + grep -qx 'exec java bootstripper.java pre-commit' .git/hooks/pre-commit || fail hook-content
154 + ok install-hooks
156 + git show HEAD:nushell/secrets.nu | head -c 6 | grep -qx DFAES1 || fail committed-encrypted
157 + ok committed-encrypted
159 + mapfile -t hosts < <(find . -maxdepth 1 -name '*.symlinks' -printf '%f\n' | sed 's/\.symlinks$//' | sort)
160 + printf 'primary-manifest=%s.symlinks\n' "$PRIMARY_HOSTNAME"
161 + printf 'manifests=%s\n' "${hosts[*]}"
163 + for host in "${hosts[@]}"; do
164 + run_manifest "$host"
165 + done
166 + ok "symlink-manifests:${#hosts[@]}"
168 + if head -c 6 nushell/secrets.nu | grep -qx DFAES1; then
169 + fail worktree-still-encrypted
170 + fi
171 + ok worktree-decrypted
173 + java bootstripper.java pre-commit >/tmp/precommit.log 2>&1 || { echo FAIL:pre-commit; cat /tmp/precommit.log; exit 1; }
174 + grep -q 'Skipping gitleaks: command not found' /tmp/precommit.log || fail gitleaks-optional
175 + ok pre-commit
177 + fresh_crypto_smoke
179 + echo RESULT:ok
180 + CONTAINER
182 +# create initial crypto salt
183 +init-crypto:
184 + java bootstripper.java init-crypto
186 +# install Git hooks
187 +hooks:
188 + java bootstripper.java install-hooks
12 190 # enable some user systemd services
13 191 services:
14 192 nu enable_user_services.nu
16 -# install git hooks with lefthook
17 -hooks:
18 - lefthook install
20 -# remove links to dorkfiles in HOME
194 +# remove links to dorkfiles from HOME
21 195 unlink:
22 196 java bootstripper.java clean
27 201 git fetch
28 202 git branch --set-upstream-to=origin/trunk trunk
30 -# initial setup: link dotfiles, enable services, install hooks, fix permissions
31 -setup: link services hooks fix_permissions
204 +# initial setup: link dotfiles, enable services, fix permissions
205 +setup: link services fix_permissions
33 207 # install previously exported winget apps. see topgrade config for exports.
34 208 import_winget:

lefthook.yml

Deleted
deleted file mode 100644
1 -pre-commit:
2 - commands:
3 - gitleaks:
4 - run: gitleaks git --pre-commit --staged

nushell/config.nu

Modified
1 1 $env.config = {
2 - edit_mode: vi
3 - show_banner: false
4 - buffer_editor: "nvim"
5 - table: {
6 - mode: markdown
7 - }
8 - rm: {
9 - always_trash: (not $env.TERMUX)
10 - }
11 - cursor_shape: {
12 - vi_insert: line
13 - vi_normal: block
14 - }
2 + edit_mode: vi
3 + show_banner: false
4 + buffer_editor: "nvim"
5 + table: {mode: markdown}
6 + rm: {
7 + always_trash: (not $env.TERMUX)
8 + }
9 + cursor_shape: {vi_insert: line, vi_normal: block}
10 + float_precision: 3
11 + shell_integration: {
12 + # osc9_9: true
13 + # unfortunately, this seems to be buggy on win32 with wezterm
14 + osc133: ($nu.os-info.family | str contains "unix")
15 + }
16 + highlight_resolved_externals: true
17 + use_kitty_protocol: (not $env.WIN32)
18 + color_config: {
16 - float_precision: 3
17 - shell_integration: {
18 - osc9_9: true
19 - # unfortunately, this seems to be buggy on win32 with wezterm
20 - osc133: ($nu.os-info.family | str contains "unix")
21 - }
20 + # -- primitives (data types) --
21 + int: green
22 + float: green
23 + bool: green_bold
24 + string: blue
25 + nothing: dark_gray
26 + binary: dark_gray
27 + duration: green
28 + range: dark_gray
29 + cell-path: dark_gray
23 - highlight_resolved_externals : true
24 - use_kitty_protocol : (not $env.WIN32)
31 + # -- table / presentation --
32 + separator: light_green
33 + header: light_blue_bold
34 + row_index: light_green
35 + leading_trailing_space_bg: dark_gray
36 + hints: cyan
37 + empty: dark_gray
38 + search_result: green_bold
26 - color_config: {
27 - # -- primitives (data types) --
28 - int: green
29 - float: green
30 - bool: green_bold
31 - string: blue
32 - nothing: dark_gray
33 - binary: dark_gray
34 - duration: green
35 - range: dark_gray
36 - cell-path: dark_gray
40 + # -- shapes (syntax highlighting, Nugu philosophy) --
41 + # human meaning → prominent (important_local / focus)
42 + shape_string: blue
43 + shape_raw_string: blue
44 + shape_string_interpolation: green_bold
45 + shape_int: green_bold
46 + shape_float: green_bold
47 + shape_bool: green_bold
48 + shape_filepath: green
49 + shape_directory: green
50 + shape_globpattern: green
51 + shape_glob_interpolation: green_bold
52 + shape_record: green
53 + shape_list: green
54 + shape_table: green
55 + shape_datetime: green_bold
56 + shape_match_pattern: blue
57 + shape_signature: blue
58 + shape_literal: white
59 + shape_custom: magenta_bold
60 + shape_closure: blue_bold
61 + shape_block: blue_bold
62 + shape_range: dark_gray
38 - # -- table / presentation --
39 - separator: light_green
40 - header: light_blue_bold
41 - row_index: light_green
42 - leading_trailing_space_bg: dark_gray
43 - hints: cyan
44 - empty: dark_gray
45 - search_result: green_bold
64 + # structural / plumbing → receded (minor)
65 + shape_keyword: dark_gray
66 + shape_operator: dark_gray
67 + shape_pipe: dark_gray
68 + shape_redirection: dark_gray
69 + shape_flag: light_cyan
70 + shape_binary: dark_gray
71 + shape_nothing: dark_gray
72 + shape_matching_brackets: dark_gray_bold
73 + shape_vardecl: white
74 + shape_variable: white
47 - # -- shapes (syntax highlighting, Nugu philosophy) --
48 - # human meaning → prominent (important_local / focus)
49 - shape_string: blue
50 - shape_raw_string: blue
51 - shape_string_interpolation: green_bold
52 - shape_int: green_bold
53 - shape_float: green_bold
54 - shape_bool: green_bold
55 - shape_filepath: green
56 - shape_directory: green
57 - shape_globpattern: green
58 - shape_glob_interpolation: green_bold
59 - shape_record: green
60 - shape_list: green
61 - shape_table: green
62 - shape_datetime: green_bold
63 - shape_match_pattern: blue
64 - shape_signature: blue
65 - shape_literal: white
66 - shape_custom: magenta_bold
67 - shape_closure: blue_bold
68 - shape_block: blue_bold
69 - shape_range: dark_gray
76 + # externals
77 + shape_external: light_magenta
78 + shape_externalarg: green_bold
79 + shape_external_resolved: magenta_bold
80 + shape_internalcall: light_cyan_bold
71 - # structural / plumbing → receded (minor)
72 - shape_keyword: dark_gray
73 - shape_operator: dark_gray
74 - shape_pipe: dark_gray
75 - shape_redirection: dark_gray
76 - shape_flag: light_cyan
77 - shape_binary: dark_gray
78 - shape_nothing: dark_gray
79 - shape_matching_brackets: dark_gray_bold
80 - shape_vardecl: white
81 - shape_variable: white
83 - # externals
84 - shape_external: light_magenta
85 - shape_externalarg: green_bold
86 - shape_external_resolved: magenta_bold
87 - shape_internalcall: light_cyan_bold
89 - # errors
90 - shape_garbage: { fg: white, bg: red, attr: b }
91 - }
93 - history: {
94 - file_format: "sqlite"
95 - isolation: true
96 - }
82 + # errors
83 + shape_garbage: {fg: white, bg: red, attr: b}
84 + }
85 + history: {file_format: "sqlite", isolation: true}

nushell/env.nu

Modified
2 2 # GLOBAL VARIABLES
4 4 #TODO move to config.nu
6 -$env.WIN32 = ( $nu.os-info.name =~ "windows" )
7 -$env.TERMUX = ( $nu.os-info.name =~ "android" )
6 +$env.WIN32 = ($nu.os-info.name =~ "windows")
7 +$env.TERMUX = ($nu.os-info.name =~ "android")
9 -$env.WORKSPACE = if $env.WIN32 { "~/Workspaces" } else { "~/Workspace" | path expand }
10 -$env.DOTFILES = ( $env.WORKSPACE | path join 'dotfiles' | path expand)
9 +$env.WORKSPACE = if $env.WIN32 { "~/Workspaces" } else {
10 + "~/Workspace" | path expand
12 +$env.DOTFILES = ($env.WORKSPACE | path join 'dotfiles' | path expand)
11 13 $env.NOTES = ("~/Notes" | path expand)
12 14 $env.TOOLS = ("~/Tools" | path expand)
13 -$env.CARGO_HOME = ( "~/.cargo" | path expand )
14 -$env.GO_HOME = ( "~/.go" | path expand )
15 -$env.DOT_LOCAL = ( "~/.local" | path expand )
15 +$env.CARGO_HOME = ("~/.cargo" | path expand)
16 +$env.GO_HOME = ("~/.go" | path expand)
17 +$env.DOT_LOCAL = ("~/.local" | path expand)
16 18 $env.DIFFTOOL = "zeditor --wait --diff"
17 -$env.OPENCODE_HOME = ( "~/.opencode" | path expand)
19 +$env.OPENCODE_HOME = ("~/.opencode" | path expand)
19 -if (not $env.WIN32) {
20 - # make sure to start ssh-agent user service: userctl enable --now ssh-agent
21 - $env.SSH_AUTH_SOCK = $"($env.XDG_RUNTIME_DIR)/ssh-agent.socket"
21 +if not $env.WIN32 {
22 + # make sure to start ssh-agent user service: userctl enable --now ssh-agent
23 + $env.SSH_AUTH_SOCK = $"($env.XDG_RUNTIME_DIR)/ssh-agent.socket"
24 26 $env.PI_SKIP_VERSION_CHECK = true
29 31 if (which sccache | is-not-empty) { $env.RUSTC_WRAPPER = "sccache" }
31 33 if $env.WIN32 {
32 - $env.Path = (
34 + $env.Path = (
33 35 $env.Path
34 36 | split row (char esep)
35 37 | append ($env.CARGO_HOME | path join bin)
39 41 | uniq # filter so the paths are unique
41 43 } else {
42 - $env.PATH = (
44 + $env.PATH = (
43 45 $env.PATH
44 46 | split row (char esep)
45 47 | append ($env.CARGO_HOME | path join bin)
54 56 if (which nvim | is-not-empty) {
55 - $env.EDITOR = 'nvim'
56 - $env.GIT_EDITOR = 'nvim'
57 + $env.EDITOR = 'nvim'
58 + $env.GIT_EDITOR = 'nvim'
59 61 if (which neovide | is-not-empty) {
60 - $env.VISUAL = 'neovide'
62 + $env.VISUAL = 'neovide'
63 65 $env.LS_COLORS = 'rs=0:di=1;34:ln=1;35:ex=1;32:bd=1;33;40:cd=1;33;40:pi=33:so=35:do=35:or=1;31:mi=1;37;41:su=37;41:sg=30;43:tw=30;41:ow=37;41:st=37;44:*.tar=1;31:*.tgz=1;31:*.zip=1;31:*.gz=1;31:*.xz=1;31:*.7z=1;31:*.rar=1;31:*.jpg=1;35:*.png=1;35:*.gif=1;35:*.bmp=1;35:*.mp4=1;33:*.mp3=1;33:*.flac=1;33:*.pdf=1;33:*.doc=1;33:*.docx=1;33:*.txt=0:*.md=0:*.c=1;34:*.cpp=1;34:*.h=1;34:*.java=1;34:*.py=1;34:*.sh=1;34:'
67 69 # - converted from a value back to a string when running external commands (to_string)
68 70 # Note: The conversions happen *after* config.nu is loaded
69 71 $env.ENV_CONVERSIONS = {
70 - "PATH": {
71 - from_string: { |s| $s | split row (char esep) }
72 - to_string: { |v| $v | str join (char esep) }
73 - }
74 - "Path": {
75 - from_string: { |s| $s | split row (char esep) }
76 - to_string: { |v| $v | str join (char esep) }
77 - }
72 + "PATH": {
73 + from_string: {|s|
74 + $s | split row (char esep)
75 + }
76 + to_string: {|v|
77 + $v | str join (char esep)
78 + }
79 + }
80 + "Path": {
81 + from_string: {|s|
82 + $s | split row (char esep)
83 + }
84 + to_string: {|v|
85 + $v | str join (char esep)
86 + }
87 + }
80 90 $env.NU_LIB_DIRS = [
81 - ($nu.default-config-dir | path join 'modules')
91 + ($nu.default-config-dir | path join 'modules')
84 94 # generate aliases here and now, so that we can apply conditions.
85 95 # later, in config.nu, the evaluated aliases will be sourced
86 96 source ($nu.default-config-dir | path join 'gen-aliases.nu')
87 -source ($nu.default-config-dir | path join 'gen-secrets.nu')
89 98 # TODO move to vendor dirs
91 100 # generate zoxide hooks for sourcing later on
92 101 let zoxide_config_path = $nu.default-config-dir | path join 'zoxide.nu'
93 102 if not (which zoxide | is-empty) {
94 - zoxide init nushell | save --force $zoxide_config_path
103 + zoxide init nushell | save --force $zoxide_config_path
95 104 } else {
96 - '' | save -f $zoxide_config_path
105 + '' | save -f $zoxide_config_path
99 108 # Carapace bridges available on this system: bash.
102 111 $env.CARAPACE_LENIENT = 1
104 113 if not (which mise | is-empty) {
105 - mkdir ($nu.vendor-autoload-dirs | last)
106 - ^mise activate nu | save --force ($nu.vendor-autoload-dirs | last | path join 'mise.nu')
114 + mkdir ($nu.vendor-autoload-dirs | last)
115 + ^mise activate nu | save --force ($nu.vendor-autoload-dirs | last | path join 'mise.nu')
109 118 if not (which niri | is-empty) {
110 - mkdir ($nu.vendor-autoload-dirs | last)
111 - ^niri completions nushell | save --force ($nu.vendor-autoload-dirs | last | path join 'niri.nu')
119 + mkdir ($nu.vendor-autoload-dirs | last)
120 + ^niri completions nushell | save --force ($nu.vendor-autoload-dirs | last | path join 'niri.nu')
123 +source secrets.nu

nushell/gen-secrets.nu

Deleted
deleted file mode 100644
1 -# create file initially, so that we can append to it later
2 -let file = $"($nu.default-config-dir)/secrets.nu"
3 -let data_file = $"($nu.config-path | path dirname)/secrets.nuon"
5 -'' | save -f $file
7 -# Load the existing secrets data if available, otherwise use an empty record
8 -let data = if ($data_file | path exists) { open $data_file } else { {} }
10 -def secret [
11 - name: string # name of the secret env var
12 - default: string = "TODO" # default value if not found in secrets.nuon
13 -] {
14 - # Try to get the value from the data file, fallback to default
15 - let value = ($data | get -o $name | default $default)
16 -
17 - # Write safe assignment to secrets.nu using 'to nuon' for string escaping
18 - $"$env.($name) = ($value | to nuon)\n" | save --append $file
19 -}
21 -########################################
22 -# Start defining your secrets here
24 -# needs to be classic token for package.nu
25 -# see: https://github.com/settings/tokens
26 -secret ECOSYSTEMS_TOKEN
27 -secret CONTEXT7_TOKEN
28 -secret GITHUB_PAT_TOKEN
29 -secret GITHUB_PAT_TOKEN_LLM
30 -secret MINIMAX_USAGE_API_KEY
31 -secret ZAI_USAGE_API_KEY
32 -secret MINIMAX_API_KEY
33 -secret ZAI_API_KEY
34 -secret MINIMAX_WORK_API_KEY
35 -secret ZAI_WORK_API_KEY
36 -secret KIMI_API_KEY

nushell/modules/git.nu

Modified
7 7 const WT_MAIN_BRANCH = "wt.main-branch"
8 8 const WT_SOURCE_PATH = "wt.source-path"
10 -# Run git and fail with stderr as Nushell error.
11 -def gitx [args: list<any>, cwd?: path] {
12 - let res = if ($cwd == null) {
10 +const DOT_GIT = ".git"
11 +const WT_ROOT_SUFFIX = ".wt"
12 +const DEFAULT_MAIN_BRANCH = "main"
13 +const HEAD = "HEAD"
14 +const REF_HEADS = "refs/heads/"
15 +const DIRTY_REFUSE = "refuse"
16 +const DIRTY_COPY = "copy"
17 +const DIRTY_MODES = ["refuse" "copy"]
18 +const STATUS_PORCELAIN = ["status" "--porcelain=v1"]
19 +const STAGED_PATCH = "staged.patch"
20 +const UNSTAGED_PATCH = "unstaged.patch"
22 +const LINE_WORKTREE = "worktree "
23 +const LINE_HEAD = "HEAD "
24 +const LINE_BRANCH = "branch "
25 +const LINE_DETACHED = "detached"
26 +const LINE_BARE = "bare"
27 +const LINE_LOCKED = "locked"
28 +const LINE_PRUNABLE = "prunable"
30 +# Run git and return completion record.
31 +def git-complete [args: list<string>, cwd?: path] {
32 + if $cwd == null {
13 33 ^git ...$args | complete
14 34 } else {
15 35 ^git -C $cwd ...$args | complete
39 +# Format a failed git invocation.
40 +def git-failure [args: list<string>, stderr: string] {
41 + let msg = ($stderr | str trim)
42 + if ($msg | is-empty) {
43 + $"git failed: git ($args | str join ' ')"
44 + } else {
45 + $msg
46 + }
49 +# Run git and return trimmed stdout; fail with stderr as Nushell error.
50 +def git-output [args: list<string>, cwd?: path] {
51 + let res = if $cwd == null { git-complete $args } else { git-complete $args $cwd }
18 53 if $res.exit_code != 0 {
19 - let msg = ($res.stderr | str trim)
20 - error make {msg: (if ($msg | is-empty) { $"git failed: git ($args | str join ' ')" } else { $msg })}
54 + error make {msg: (git-failure $args $res.stderr)}
23 57 $res.stdout | str trim
26 -# Run git, return completion record.
27 -def gitc [args: list<any>, cwd?: path] {
28 - if ($cwd == null) {
29 - ^git ...$args | complete
30 - } else {
31 - ^git -C $cwd ...$args | complete
32 - }
60 +# Compatibility wrappers used by the rest of this module.
61 +def gitx [args: list<string>, cwd?: path] {
62 + if $cwd == null { git-output $args } else { git-output $args $cwd }
65 +def gitc [args: list<string>, cwd?: path] {
66 + if $cwd == null { git-complete $args } else { git-complete $args $cwd }
69 +def git-dir-args [git_dir: path, args: list<string>] {
70 + ["--git-dir" $git_dir] | append $args
73 +def git-dir-output [git_dir: path, args: list<string>] {
74 + git-output (git-dir-args $git_dir $args)
77 +def git-dir-complete [git_dir: path, args: list<string>] {
78 + git-complete (git-dir-args $git_dir $args)
81 +def git-config [git_dir: path, key: string] {
82 + let res = (git-dir-complete $git_dir ["config" "--get" $key])
83 + if $res.exit_code == 0 { $res.stdout | str trim } else { null }
86 +def git-config-bool [git_dir: path, key: string] {
87 + let res = (git-dir-complete $git_dir ["config" "--bool" "--get" $key])
88 + if $res.exit_code == 0 { $res.stdout | str trim } else { null }
91 +def git-config-set [git_dir: path, key: string, value: string] {
92 + git-dir-output $git_dir ["config" $key $value] | ignore
35 95 # Branch name -> path-safe suffix.
42 102 # URL/path -> repo name.
43 103 def repo-name-from [source: string] {
44 - let base = ($source | path basename)
45 - $base | str replace --regex '\.git$' ''
104 + $source | path basename | str replace --regex '\.git$' ''
48 107 # Current layout record. Fails outside co/wt layout.
49 108 def layout [] {
50 - let common = (gitx ["rev-parse" "--path-format=absolute" "--git-common-dir"])
51 - let bare = (gitc ["--git-dir" $common "config" "--bool" "--get" "core.bare"])
109 + let git_dir = (git-output ["rev-parse" "--path-format=absolute" "--git-common-dir"])
53 - if (($bare.stdout | str trim) != "true") {
111 + if (git-config-bool $git_dir "core.bare") != "true" {
54 112 error make {msg: "not inside co/wt layout: git common dir is not bare"}
57 - let root = ($common | path dirname)
58 - let repo_res = (gitc ["--git-dir" $common "config" "--get" $WT_REPO_NAME])
59 - let repo = if $repo_res.exit_code == 0 {
60 - $repo_res.stdout | str trim
61 - } else {
62 - $root | path basename | str replace --regex '\.wt$' ''
63 - }
115 + let root = ($git_dir | path dirname)
116 + let repo = (git-config $git_dir $WT_REPO_NAME | default ($root | path basename | str replace --regex $"($WT_ROOT_SUFFIX)$" ""))
117 + let main = (git-config $git_dir $WT_MAIN_BRANCH | default $DEFAULT_MAIN_BRANCH)
65 - let main_res = (gitc ["--git-dir" $common "config" "--get" $WT_MAIN_BRANCH])
66 - let main = if $main_res.exit_code == 0 { $main_res.stdout | str trim } else { "main" }
68 - {root: $root, git_dir: $common, repo: $repo, main: $main}
119 + {root: $root, git_dir: $git_dir, repo: $repo, main: $main}
71 -# Computed worktree path for branch.
122 +# Computed conventional worktree path for branch.
72 123 def wt-path [branch: string] {
73 124 let l = (layout)
74 125 [$l.root $"($l.repo).(branch-slug $branch)"] | path join
128 +def empty-worktree-record [] {
129 + {path: null, head: null, branch: null, detached: false, bare: false, locked: false, lock_reason: null, prunable: false}
132 +def strip-prefix [line: string, prefix: string] {
133 + $line | str replace $prefix ""
136 +def parse-lock-line [line: string] {
137 + let reason = (strip-prefix $line $LINE_LOCKED | str trim)
138 + if ($reason | is-empty) { null } else { $reason }
141 +def parse-worktree-line [rec: record, line: string] {
142 + if ($line | str starts-with $LINE_WORKTREE) {
143 + return ($rec | upsert path (strip-prefix $line $LINE_WORKTREE))
145 + if ($line | str starts-with $LINE_HEAD) {
146 + return ($rec | upsert head (strip-prefix $line $LINE_HEAD))
148 + if ($line | str starts-with $LINE_BRANCH) {
149 + let branch = (strip-prefix $line $LINE_BRANCH | str replace $REF_HEADS "")
150 + return ($rec | upsert branch $branch)
152 + if $line == $LINE_DETACHED {
153 + return ($rec | upsert detached true)
155 + if $line == $LINE_BARE {
156 + return ($rec | upsert bare true)
158 + if ($line | str starts-with $LINE_LOCKED) {
159 + return ($rec | upsert locked true | upsert lock_reason (parse-lock-line $line))
161 + if ($line | str starts-with $LINE_PRUNABLE) {
162 + return ($rec | upsert prunable true)
165 + $rec
168 +def parse-worktree-block [block: string] {
169 + $block | lines | reduce --fold (empty-worktree-record) {|line, rec| parse-worktree-line $rec $line }
77 172 # Parse `git worktree list --porcelain` into records.
78 173 def parse-worktree-list [text: string] {
80 175 | split row "\n\n"
81 176 | where {|block| not (($block | str trim) | is-empty) }
82 - | each {|block|
83 - mut rec = {path: null, head: null, branch: null, detached: false, bare: false, locked: false, lock_reason: null, prunable: false}
85 - for line in ($block | lines) {
86 - if ($line | str starts-with "worktree ") {
87 - $rec = ($rec | upsert path ($line | str replace "worktree " ""))
88 - } else if ($line | str starts-with "HEAD ") {
89 - $rec = ($rec | upsert head ($line | str replace "HEAD " ""))
90 - } else if ($line | str starts-with "branch ") {
91 - let b = ($line | str replace "branch " "" | str replace "refs/heads/" "")
92 - $rec = ($rec | upsert branch $b)
93 - } else if $line == "detached" {
94 - $rec = ($rec | upsert detached true)
95 - } else if $line == "bare" {
96 - $rec = ($rec | upsert bare true)
97 - } else if ($line | str starts-with "locked") {
98 - let reason = ($line | str replace "locked" "" | str trim)
99 - $rec = ($rec | upsert locked true | upsert lock_reason (if ($reason | is-empty) { null } else { $reason }))
100 - } else if ($line | str starts-with "prunable") {
101 - $rec = ($rec | upsert prunable true)
102 - }
103 - }
105 - $rec
106 - }
177 + | each {|block| parse-worktree-block $block }
109 180 # Worktree table, no dirty check.
110 181 def worktrees-basic [] {
111 182 let l = (layout)
112 - parse-worktree-list (gitx ["--git-dir" $l.git_dir "worktree" "list" "--porcelain"])
183 + parse-worktree-list (git-dir-output $l.git_dir ["worktree" "list" "--porcelain"])
115 186 # Find actual worktree path by branch; fallback to convention path.
118 189 if ($found == null) { wt-path $branch } else { $found.path }
192 +def branch-exists [git_dir: path, branch: string] {
193 + (git-dir-complete $git_dir ["show-ref" "--verify" "--quiet" $"($REF_HEADS)($branch)"]).exit_code == 0
196 +def add-worktree [git_dir: path, path: path, branch: string, base: string] {
197 + let args = if (branch-exists $git_dir $branch) {
198 + ["worktree" "add" $path $branch]
199 + } else {
200 + ["worktree" "add" "-b" $branch $path $base]
203 + git-dir-output $git_dir $args | ignore
121 206 # Create branch + worktree, or add existing branch.
122 207 def create-worktree [branch: string, base: string] {
123 208 let l = (layout)
127 212 error make {msg: $"path exists: ($path)"}
130 - let exists = ((gitc ["--git-dir" $l.git_dir "show-ref" "--verify" "--quiet" $"refs/heads/($branch)"]).exit_code == 0)
132 - if $exists {
133 - gitx ["--git-dir" $l.git_dir "worktree" "add" $path $branch] | ignore
134 - } else {
135 - gitx ["--git-dir" $l.git_dir "worktree" "add" "-b" $branch $path $base] | ignore
136 - }
215 + add-worktree $l.git_dir $path $branch $base
141 219 # Current branch, refusing detached HEAD.
142 220 def current-branch [] {
143 - let b = (gitx ["rev-parse" "--abbrev-ref" "HEAD"])
144 - if $b == "HEAD" { error make {msg: "detached HEAD is not supported"} }
145 - $b
221 + let branch = (git-output ["rev-parse" "--abbrev-ref" $HEAD])
222 + if $branch == $HEAD { error make {msg: "detached HEAD is not supported"} }
223 + $branch
226 +def current-repo-top [] {
227 + try { git-output ["rev-parse" "--show-toplevel"] | path expand } catch { "" }
230 +def existing-main-or-root [layout: record] {
231 + let main_path = (path-for-branch $layout.main)
232 + if ($main_path | path exists) { $main_path } else { $layout.root }
235 +def --env cd-away-from-target [layout: record, target: path, branch: string] {
236 + if $target != (current-repo-top) { return }
238 + if $branch == $layout.main {
239 + cd $layout.root
240 + } else {
241 + cd (existing-main-or-root $layout)
245 +def remove-worktree-args [target: path, force: bool] {
246 + if $force { ["worktree" "remove" "--force" $target] } else { ["worktree" "remove" $target] }
249 +def delete-branch [git_dir: path, branch: string, force: bool] {
250 + let flag = if $force { "-D" } else { "-d" }
251 + git-dir-output $git_dir ["branch" $flag $branch] | ignore
148 254 # Remove worktree, maybe branch, and cd away if removing current worktree.
149 255 def --env remove-worktree [branch: string, delete_branch: bool, force: bool] {
150 256 let l = (layout)
151 257 let target = (path-for-branch $branch | path expand)
152 - let cwd_top = (try { gitx ["rev-parse" "--show-toplevel"] } catch { "" } | path expand)
154 - if $target == $cwd_top {
155 - if $branch == $l.main {
156 - cd $l.root
157 - } else {
158 - let main_path = (path-for-branch $l.main)
159 - if ($main_path | path exists) { cd $main_path } else { cd $l.root }
160 - }
161 - }
163 - let remove_args = if $force {
164 - ["--git-dir" $l.git_dir "worktree" "remove" "--force" $target]
165 - } else {
166 - ["--git-dir" $l.git_dir "worktree" "remove" $target]
167 - }
168 - gitx $remove_args | ignore
259 + cd-away-from-target $l $target $branch
260 + git-dir-output $l.git_dir (remove-worktree-args $target $force) | ignore
170 262 if $delete_branch {
171 - let branch_flag = if $force { "-D" } else { "-d" }
172 - gitx ["--git-dir" $l.git_dir "branch" $branch_flag $branch] | ignore
263 + delete-branch $l.git_dir $branch $force
175 266 $target
269 +def init-bare-layout [source: string, git_dir: path, repo: string, main: string] {
270 + git-output ["clone" "--bare" $source $git_dir] | ignore
271 + git-config-set $git_dir $WT_REPO_NAME $repo
272 + git-config-set $git_dir $WT_MAIN_BRANCH $main
275 +def remember-source [git_dir: path, source: path] {
276 + git-config-set $git_dir $WT_SOURCE_PATH $source
279 +def choose-fresh-branch [git_dir: path, branch: any] {
280 + if (($branch == null) or ($branch | is-empty)) {
281 + git-dir-output $git_dir ["symbolic-ref" "--short" $HEAD]
282 + } else {
283 + $branch
287 +def selected-branch [branch: any] {
288 + if (($branch == null) or ($branch | is-empty)) { current-branch } else { $branch }
178 291 # Create fresh layout from remote/local repo URL/path.
179 292 def --env co-fresh [source: string, name?: string, branch?: string, dir?: path] {
180 293 let repo = if ($name == null) { repo-name-from $source } else { $name }
181 294 let parent = if ($dir == null) { "." } else { $dir }
182 295 let root = ([$parent $repo] | path join | path expand)
183 - let git_dir = ([$root ".git"] | path join)
296 + let git_dir = ([$root $DOT_GIT] | path join)
185 298 if ($root | path exists) {
186 299 error make {msg: $"target exists: ($root)"}
189 302 mkdir $root
190 - gitx ["clone" "--bare" $source $git_dir] | ignore
303 + git-output ["clone" "--bare" $source $git_dir] | ignore
192 - let chosen_branch = if (($branch == null) or ($branch | is-empty)) {
193 - gitx ["--git-dir" $git_dir "symbolic-ref" "--short" "HEAD"]
194 - } else {
195 - $branch
196 - }
198 - gitx ["--git-dir" $git_dir "config" $WT_REPO_NAME $repo] | ignore
199 - gitx ["--git-dir" $git_dir "config" $WT_MAIN_BRANCH $chosen_branch] | ignore
305 + let chosen_branch = (choose-fresh-branch $git_dir $branch)
306 + git-config-set $git_dir $WT_REPO_NAME $repo
307 + git-config-set $git_dir $WT_MAIN_BRANCH $chosen_branch
201 309 let worktree = ([$root $"($repo).(branch-slug $chosen_branch)"] | path join)
202 - gitx ["--git-dir" $git_dir "worktree" "add" $worktree $chosen_branch] | ignore
310 + git-dir-output $git_dir ["worktree" "add" $worktree $chosen_branch] | ignore
203 311 cd $worktree
205 313 {root: $root, worktree: $worktree, branch: $chosen_branch}
208 -# Migrate current checkout into sibling .wt layout; original untouched.
209 -def --env co-current [name?: string, branch?: string, plan: bool = false, dirty: string = "refuse"] {
210 - let src = (gitx ["rev-parse" "--show-toplevel"] | path expand)
211 - let src_name = ($src | path basename)
212 - let repo = if ($name == null) { $src_name } else { $name }
213 - let parent = ($src | path dirname)
214 - let root = ([$parent $"($repo).wt"] | path join | path expand)
215 - let git_dir = ([$root ".git"] | path join)
216 - let current = (current-branch)
217 - let chosen_branch = if (($branch == null) or ($branch | is-empty)) { $current } else { $branch }
218 - let target = ([$root $"($repo).(branch-slug $chosen_branch)"] | path join)
219 - let status_before = (gitx ["status" "--porcelain=v1"] $src)
220 - let is_dirty = (not ($status_before | is-empty))
221 - let stash_res = (gitc ["stash" "list"] $src)
222 - let stash_count = if $stash_res.exit_code == 0 { ($stash_res.stdout | lines | length) } else { 0 }
316 +def status-porcelain [cwd: path] {
317 + git-output $STATUS_PORCELAIN $cwd
224 - if not ($dirty in ["refuse" "copy"]) {
225 - error make {msg: "--dirty must be one of: refuse, copy"}
320 +def stash-count [cwd: path] {
321 + let res = (git-complete ["stash" "list"] $cwd)
322 + if $res.exit_code == 0 { $res.stdout | lines | length } else { 0 }
325 +def assert-dirty-mode [dirty: string] {
326 + if not ($dirty in $DIRTY_MODES) {
327 + error make {msg: $"--dirty must be one of: ($DIRTY_MODES | str join ', ')"}
228 - let migration = {
331 +def migration-plan [dirty_mode: string, name: any, branch: any] {
332 + assert-dirty-mode $dirty_mode
334 + let src = (git-output ["rev-parse" "--show-toplevel"] | path expand)
335 + let repo = if ($name == null) { $src | path basename } else { $name }
336 + let parent = ($src | path dirname)
337 + let root = ([$parent $"($repo)($WT_ROOT_SUFFIX)"] | path join | path expand)
338 + let git_dir = ([$root $DOT_GIT] | path join)
339 + let chosen_branch = (selected-branch $branch)
340 + let target = ([$root $"($repo).(branch-slug $chosen_branch)"] | path join)
341 + let status_before = (status-porcelain $src)
342 + let is_dirty = (not ($status_before | is-empty))
229 345 mode: "current-checkout"
230 346 source: $src
231 347 target_root: $root
234 350 repo: $repo
235 351 branch: $chosen_branch
236 352 dirty: $is_dirty
237 - dirty_mode: $dirty
238 - stashes: $stash_count
353 + dirty_mode: $dirty_mode
354 + stashes: (stash-count $src)
239 355 destructive: false
356 + status_before: $status_before
360 +def public-migration [plan: record] {
361 + $plan | reject status_before
364 +def assert-migration-ready [plan: record] {
365 + if ($plan.target_root | path exists) {
366 + error make {msg: $"target exists: ($plan.target_root)"}
242 - if $plan { return $migration }
244 - if ($root | path exists) {
245 - error make {msg: $"target exists: ($root)"}
246 - }
248 - if $is_dirty and $dirty == "refuse" {
369 + if $plan.dirty and $plan.dirty_mode == $DIRTY_REFUSE {
249 370 error make {msg: "working tree has changes; rerun with `co . --dirty copy` or commit/stash first"}
252 - if $stash_count > 0 {
253 - print -e $"warning: ($stash_count) stash(es) remain only in original checkout: ($src)"
374 +def warn-stashes [plan: record] {
375 + if $plan.stashes > 0 {
376 + print -e $"warning: ($plan.stashes) stash(es) remain only in original checkout: ($plan.source)"
380 +def patch-paths [tmp: path] {
381 + {staged: ([$tmp $STAGED_PATCH] | path join), unstaged: ([$tmp $UNSTAGED_PATCH] | path join)}
384 +def write-dirty-patches [source: path, tmp: path] {
385 + let patches = (patch-paths $tmp)
386 + ^git -C $source diff --binary --cached | save --force $patches.staged
387 + ^git -C $source diff --binary | save --force $patches.unstaged
388 + $patches
391 +def patch-has-data [patch: path] {
392 + not ((open --raw $patch) | is-empty)
395 +def apply-patch [target: path, args: list<string>, patch: path] {
396 + if (patch-has-data $patch) {
397 + git-output (["apply"] | append $args | append $patch) $target | ignore
401 +def apply-dirty-patches [target: path, patches: record] {
402 + apply-patch $target ["--index"] $patches.staged
403 + apply-patch $target [] $patches.unstaged
406 +def assert-external-ok [name: string, res: record] {
407 + if $res.exit_code != 0 {
408 + let msg = ($res.stderr | str trim)
409 + error make {msg: (if ($msg | is-empty) { $"($name) failed" } else { $msg })}
413 +def copy-untracked [source: path, target: path] {
414 + git-output ["status"] $source | ignore # sanity: source still repo
416 + if (which rsync | is-not-empty) {
417 + assert-external-ok "rsync" (^rsync -a --ignore-existing --exclude .git $"($source)/" $"($target)/" | complete)
418 + } else {
419 + assert-external-ok "cp" (^cp -a -n $"($source)/." $target | complete)
423 +def copy-dirty-state [plan: record, patches: record] {
424 + apply-dirty-patches $plan.target_worktree $patches
425 + copy-untracked $plan.source $plan.target_worktree
427 + let status_after = (status-porcelain $plan.target_worktree)
428 + if $plan.status_before != $status_after {
429 + error make {msg: $"dirty-copy verification failed; original untouched at ($plan.source), target left for inspection at ($plan.target_root)"}
433 +def create-migration-layout [plan: record] {
434 + mkdir $plan.target_root
435 + init-bare-layout $plan.source $plan.target_git_dir $plan.repo $plan.branch
436 + remember-source $plan.target_git_dir $plan.source
437 + git-dir-output $plan.target_git_dir ["worktree" "add" $plan.target_worktree $plan.branch] | ignore
440 +# Migrate current checkout into sibling .wt layout; original untouched.
441 +def --env co-current [name?: string, branch?: string, plan: bool = false, dirty: string = $DIRTY_REFUSE] {
442 + let migration = (migration-plan $dirty $name $branch)
443 + if $plan { return (public-migration $migration) }
445 + assert-migration-ready $migration
446 + warn-stashes $migration
448 + let tmp = if $migration.dirty { mktemp -d } else { null }
450 + try {
451 + let patches = if $migration.dirty { write-dirty-patches $migration.source $tmp } else { null }
452 + create-migration-layout $migration
453 + if $migration.dirty {
454 + copy-dirty-state $migration $patches
456 + if $tmp != null { rm -rf $tmp }
457 + } catch {|err|
458 + if $tmp != null { rm -rf $tmp }
459 + error make {msg: $err.msg}
256 - let tmp = (mktemp -d)
257 - let staged_patch = ([$tmp "staged.patch"] | path join)
258 - let unstaged_patch = ([$tmp "unstaged.patch"] | path join)
260 - if $is_dirty {
261 - ^git -C $src diff --binary --cached | save --force $staged_patch
262 - ^git -C $src diff --binary | save --force $unstaged_patch
263 - }
265 - mkdir $root
266 - gitx ["clone" "--bare" $src $git_dir] | ignore
267 - gitx ["--git-dir" $git_dir "config" $WT_REPO_NAME $repo] | ignore
268 - gitx ["--git-dir" $git_dir "config" $WT_MAIN_BRANCH $chosen_branch] | ignore
269 - gitx ["--git-dir" $git_dir "config" $WT_SOURCE_PATH $src] | ignore
270 - gitx ["--git-dir" $git_dir "worktree" "add" $target $chosen_branch] | ignore
272 - if $is_dirty {
273 - if (not ((open --raw $staged_patch) | is-empty)) {
274 - gitx ["apply" "--index" $staged_patch] $target | ignore
275 - }
276 - if (not ((open --raw $unstaged_patch) | is-empty)) {
277 - gitx ["apply" $unstaged_patch] $target | ignore
278 - }
280 - let rsync = (which rsync | length) > 0
281 - if $rsync {
282 - gitx ["-C" $src "status"] | ignore # cheap sanity: source still repo
283 - ^rsync -a --ignore-existing --exclude .git $"($src)/" $"($target)/" | complete | ignore
284 - } else {
285 - ^cp -a -n $"($src)/." $target | complete | ignore
286 - }
288 - let status_after = (gitx ["status" "--porcelain=v1"] $target)
289 - if $status_before != $status_after {
290 - error make {msg: $"dirty-copy verification failed; original untouched at ($src), target left for inspection at ($root)"}
291 - }
292 - }
294 - rm -rf $tmp
295 - cd $target
297 - $migration
462 + cd $migration.target_worktree
463 + public-migration $migration
300 466 # Bootstrap checkout.
301 467 export def --env co [
302 - source: string = "." # URL/path, or `.` to migrate current checkout
303 - name?: string # repo/root name
468 + source: string = "." # URL/path, or `.` to migrate current checkout
469 + name?: string # repo/root name
304 470 --branch (-b): string = "" # branch to check out; default remote/current HEAD
305 - --dir (-d): path = "." # parent dir for fresh checkout
306 - --plan # with `co .`: preview only
307 - --dirty: string = "refuse" # `refuse` | `copy`
471 + --dir (-d): path = "." # parent dir for fresh checkout
472 + --plan # with `co .`: preview only
473 + --dirty: string = $DIRTY_REFUSE # `refuse` | `copy`
309 475 if $source == "." {
310 476 co-current $name $branch $plan $dirty
311 477 } else {
312 478 if $plan { error make {msg: "--plan only applies to `co .`"} }
313 - if $dirty != "refuse" { error make {msg: "--dirty only applies to `co .`"} }
479 + if $dirty != $DIRTY_REFUSE { error make {msg: "--dirty only applies to `co .`"} }
314 480 co-fresh $source $name $branch $dir
322 488 export def "wt repo" [] { (layout).repo }
323 489 export def "wt path" [branch: string] { wt-path $branch }
491 +def worktree-dirty [row: record] {
492 + if (($row.path | path exists) and (not $row.bare) and ($row.branch != null)) {
493 + not ((status-porcelain $row.path) | is-empty)
494 + } else {
495 + false
325 499 export def "wt ls" [] {
326 - let cwd_top = (try { gitx ["rev-parse" "--show-toplevel"] } catch { "" } | path expand)
500 + let cwd_top = (current-repo-top)
328 502 worktrees-basic | where bare == false | each {|row|
329 - let p = ($row.path | path expand)
330 - let dirty = if (($p | path exists) and (not $row.bare) and ($row.branch != null)) {
331 - not ((gitx ["status" "--porcelain=v1"] $p) | is-empty)
332 - } else {
333 - false
334 - }
503 + let path = ($row.path | path expand)
337 - | upsert current ($p == $cwd_top)
338 - | upsert dirty $dirty
505 + | upsert current ($path == $cwd_top)
506 + | upsert dirty (worktree-dirty $row)
342 510 export def --env "wt new" [
343 511 branch: string
344 - --base (-b): string = "HEAD"
512 + --base (-b): string = $HEAD
345 513 --switch (-s)
347 - let p = (create-worktree $branch $base)
348 - if $switch { cd $p }
349 - $p
515 + let path = (create-worktree $branch $base)
516 + if $switch { cd $path }
517 + $path
352 520 export def --env "wt go" [
353 521 branch: string
354 522 --create (-c)
355 - --base (-b): string = "HEAD"
523 + --base (-b): string = $HEAD
357 - let p = (path-for-branch $branch)
358 - if (not ($p | path exists)) {
359 - if $create {
360 - create-worktree $branch $base | ignore
361 - } else {
525 + let path = (path-for-branch $branch)
526 + if not ($path | path exists) {
527 + if not $create {
362 528 error make {msg: $"no worktree for branch `($branch)`; rerun with --create"}
530 + create-worktree $branch $base | ignore
365 - cd $p
366 - $p
532 + cd $path
533 + $path
369 536 export def --env "wt rm" [
386 553 export def "wt prune" [] {
387 - let l = (layout)
388 - gitx ["--git-dir" $l.git_dir "worktree" "prune"] | ignore
554 + git-dir-output (layout).git_dir ["worktree" "prune"] | ignore
391 557 export def "wt repair" [] {
392 - let l = (layout)
393 - gitx ["--git-dir" $l.git_dir "worktree" "repair"] | ignore
558 + git-dir-output (layout).git_dir ["worktree" "repair"] | ignore
396 561 # Thin native aliases for muscle memory / git parity.
397 -export def --env "wt add" [branch: string, --base (-b): string = "HEAD", --switch (-s)] {
562 +export def --env "wt add" [branch: string, --base (-b): string = $HEAD, --switch (-s)] {
398 563 wt new $branch --base $base --switch=$switch
403 568 export def "wt lock" [branch?: string, reason?: string] {
404 569 let b = if ($branch == null) { current-branch } else { $branch }
405 - let p = (path-for-branch $b)
570 + let path = (path-for-branch $b)
406 571 let l = (layout)
407 - if ($reason == null) {
408 - gitx ["--git-dir" $l.git_dir "worktree" "lock" $p] | ignore
409 - } else {
410 - gitx ["--git-dir" $l.git_dir "worktree" "lock" "--reason" $reason $p] | ignore
411 - }
572 + let args = if ($reason == null) { ["worktree" "lock" $path] } else { ["worktree" "lock" "--reason" $reason $path] }
573 + git-dir-output $l.git_dir $args | ignore
414 576 export def "wt unlock" [branch?: string] {
415 577 let b = if ($branch == null) { current-branch } else { $branch }
416 - let p = (path-for-branch $b)
417 - let l = (layout)
418 - gitx ["--git-dir" $l.git_dir "worktree" "unlock" $p] | ignore
578 + git-dir-output (layout).git_dir ["worktree" "unlock" (path-for-branch $b)] | ignore
421 581 export def "wt move" [branch: string, dest: path] {
422 - let p = (path-for-branch $branch)
423 - let l = (layout)
424 - gitx ["--git-dir" $l.git_dir "worktree" "move" $p $dest] | ignore
582 + git-dir-output (layout).git_dir ["worktree" "move" (path-for-branch $branch) $dest] | ignore

nushell/modules/prompt.nu

Modified
1 -# Map of paths to icons.
2 -# These will be used to replace certain path segments in the prompt for example.
3 -# Order these paths for precedence.
4 -def icons [] {
5 - [
6 - [ path icon ];
1 +# Fast prompt. Git is read from files; jj uses --ignore-working-copy and never snapshots.
8 - [ "/home/oli/Notes" (char -u "03C0") ]
9 - [ "/home/okr/Notes" (char -u "03C0") ]
10 - [ "/home/bugabinga/Notes" (char -u "03C0") ]
11 - [ "/data/data/com.termux/files/home/Notes" (char -u "03C0")]
12 - [ "C:\\Users\\okr\\Notizen" (char -u "03C0") ]
3 +const ICON_NOTES = (char -u "03C0")
4 +const ICON_WORKSPACE = (char -u "03BB")
5 +const ICON_HOME = (char home)
6 +const ICON_GIT = (char nf_git)
7 +const ICON_BRANCH = (char nf_branch)
8 +const ICON_CHECK = (char -u "2713")
9 +const ICON_FAILED = (char failed)
10 +const ICON_PIPE = (char pipe)
11 +const ICON_PROMPT = (char prompt)
12 +const ICON_JJ = (char -u "f329") # nf-linux-parrot
13 +const ICON_JJ_AT = "@"
14 +const ICON_UNKNOWN = "?"
15 +const FLAG_EMPTY = "∅"
16 +const FLAG_CONFLICT = "×"
17 +const FLAG_DIVERGENT = "≈"
14 - [ "/home/oli/Workspace" (char -u "03BB") ]
15 - [ "/home/okr/Workspace" (char -u "03BB") ]
16 - [ "/home/bugabinga/Workspace" (char -u "03BB") ]
17 - [ "/data/data/com.termux/files/home/Workspace" (char -u "03BB")]
18 - [ "C:\\Users\\okr\\Workspaces" (char -u "03BB") ]
19 +const ANSI_DARK_GRAY = (ansi dark_gray)
20 +const ANSI_DARK_GRAY_DIMMED = (ansi dark_gray_dimmed)
21 +const ANSI_GREEN = (ansi green)
22 +const ANSI_MAGENTA = (ansi magenta)
23 +const ANSI_RED = (ansi red)
24 +const ANSI_RESET = (ansi reset)
20 - [ "/home/oli" (char home) ]
21 - [ "/home/okr" (char home) ]
22 - [ "/home/bugabinga" (char home) ]
23 - [ "/data/data/com.termux/files/home" (char home) ]
24 - [ "C:\\Users\\okr" (char home) ]
25 - ]
26 +const PATH_SEP = (char path_sep)
27 +const TRUNCATE_DEPTH = 5
28 +const TRUNCATE_SYMBOL = $"…($PATH_SEP)"
29 +const NOTES_DIR = "Notes"
30 +const WORKSPACE_DIR = "Workspace"
32 +const VCS_GIT = "git"
33 +const VCS_JJ = "jj"
34 +const DOT_GIT = ".git"
35 +const DOT_JJ = ".jj"
36 +const HEAD_FILE = "HEAD"
37 +const OBJECTS_DIR = "objects"
38 +const REFS_DIR = "refs"
39 +const GITDIR_PREFIX = "gitdir: "
40 +const REF_HEADS_PREFIX = "ref: refs/heads/"
41 +const DETACHED_LABEL = "HEAD"
43 +const JJ_TEMPLATE = '"{\"change\":" ++ change_id.short().escape_json() ++ ",\"bookmarks\":" ++ stringify(local_bookmarks.join(",")).escape_json() ++ ",\"empty\":" ++ json(empty) ++ ",\"conflict\":" ++ json(conflict) ++ ",\"divergent\":" ++ json(divergent) ++ "}\n"'
45 +const PROMPT_INDICATOR_TEXT = $"($ANSI_GREEN) ⚈ ($ANSI_RESET)"
46 +const PROMPT_INSERT_TEXT = $"($ANSI_MAGENTA) ($ICON_PIPE) ($ANSI_RESET)"
47 +const PROMPT_NORMAL_TEXT = $"($ANSI_MAGENTA) ($ICON_PROMPT) ($ANSI_RESET)"
48 +const PROMPT_MULTILINE_TEXT = $"($ANSI_MAGENTA) ($ICON_PROMPT)($ICON_PROMPT) ($ANSI_RESET)"
50 +# Expand `~`; leave absolute/relative paths to `path join`/`path expand`.
51 +def expand-home [path: string] {
52 + if ($path | str starts-with "~") { $path | path expand } else { $path }
28 -def prompt-git-branch [] {
55 +# Resolve gitdir paths from `.git` files and `$GIT_DIR`.
56 +def resolve-git-path [path: string, base: path] {
57 + $base | path join (expand-home $path) | path expand
31 -def get_vcs_path [] {
32 - #normalize path
33 - let pwd = ($env.PWD | path expand)
60 +def git-dir-from-file [dotgit: path, base: path] {
61 + let line = (try { open --raw $dotgit | str trim } catch { return null })
62 + if ($line | str starts-with $GITDIR_PREFIX) {
63 + resolve-git-path ($line | str replace $GITDIR_PREFIX "") $base
64 + }
35 - let svn_relative_cmd = ( do --ignore-errors { ^svn info --show-item relative-url --no-newline $pwd | complete } )
36 - let svn_relative_path = if ( (not ($svn_relative_cmd | is-empty)) and ($svn_relative_cmd.exit_code == 0)) { $" 🐢 (char nf_branch) ($svn_relative_cmd.stdout)" }
67 +def is-conventional-bare-git-dir [dir: path] {
68 + ($dir | path basename) == $DOT_GIT and (($dir | path join $HEAD_FILE) | path type) == file and (($dir | path join $OBJECTS_DIR) | path exists) and (($dir | path join $REFS_DIR) | path exists)
38 - let git_branch_cmd = ( do -i { ^git rev-parse --abbrev-ref HEAD | complete } )
39 - let git_path = if (not ($git_branch_cmd | is-empty) and ($git_branch_cmd.exit_code == 0)) { $" (char nf_git) (char nf_branch) ($git_branch_cmd.stdout | str trim -r)" }
71 +def env-git-vcs [] {
72 + let git_dir = $env.GIT_DIR?
73 + if ($git_dir == null) or ($git_dir | is-empty) { return null }
75 + {kind: $VCS_GIT, git_dir: (resolve-git-path $git_dir $env.PWD)}
78 +def find-git-or-colocated-jj [] {
79 + mut dir = ($env.PWD | path expand)
81 + loop {
82 + let dotgit = ($dir | path join $DOT_GIT)
83 + let type = ($dotgit | path type)
85 + if $type == dir {
86 + if (($dir | path join $DOT_JJ) | path type) == dir { return {kind: $VCS_JJ, root: $dir} }
87 + return {kind: $VCS_GIT, git_dir: $dotgit}
88 + }
90 + if $type == file {
91 + let git_dir = (git-dir-from-file $dotgit $dir)
92 + if $git_dir != null {
93 + if (($dir | path join $DOT_JJ) | path type) == dir { return {kind: $VCS_JJ, root: $dir} }
94 + return {kind: $VCS_GIT, git_dir: $git_dir}
95 + }
96 + }
98 + if (is-conventional-bare-git-dir $dir) { return {kind: $VCS_GIT, git_dir: $dir} }
100 + let parent = ($dir | path dirname)
101 + if $parent == $dir { return (env-git-vcs) }
102 + $dir = $parent
106 +def find-jj-only [] {
107 + mut dir = ($env.PWD | path expand)
109 + loop {
110 + if (($dir | path join $DOT_JJ) | path type) == dir { return {kind: $VCS_JJ, root: $dir} }
112 + let parent = ($dir | path dirname)
113 + if $parent == $dir { return null }
114 + $dir = $parent
118 +def find-vcs [] {
119 + let vcs = (find-git-or-colocated-jj)
120 + if $vcs != null { return $vcs }
122 + find-jj-only
125 +def branch-from-head [head: string] {
126 + if ($head | str starts-with $REF_HEADS_PREFIX) {
127 + $head | str replace $REF_HEADS_PREFIX ""
128 + } else {
129 + $DETACHED_LABEL
133 +def git-segment [git_dir: path] {
134 + let head = (try { open --raw ($git_dir | path join $HEAD_FILE) | str trim } catch { return null })
135 + let branch = (branch-from-head $head)
136 + $" ($ICON_GIT) ($ICON_BRANCH) ($branch)"
139 +def jj-installed [] {
140 + which jj | is-not-empty
143 +# Query jj in prompt-safe mode: no snapshot, no pager, no color, JSON template.
144 +def jj-info [root: path] {
145 + if not (jj-installed) { return {available: false} }
147 + let res = (try { ^jj -R $root --ignore-working-copy --no-pager --color never log --no-graph -r @ -T $JJ_TEMPLATE | complete } catch { return {available: false} })
148 + if $res.exit_code != 0 { return null }
150 + try { $res.stdout | from json | upsert available true } catch { null }
153 +def jj-flags [info: record] {
42 - $svn_relative_path
43 - $git_path
155 + (if $info.empty { $FLAG_EMPTY })
156 + (if $info.conflict { $FLAG_CONFLICT })
157 + (if $info.divergent { $FLAG_DIVERGENT })
44 158 ] | str join
161 +def suffix [value: string] {
162 + if ($value | is-empty) { "" } else { $" ($value)" }
165 +def jj-segment [root: path] {
166 + let info = (jj-info $root)
167 + if $info == null { return null }
168 + if not $info.available { return $" ($ICON_JJ) ($ICON_UNKNOWN)" }
170 + $" ($ICON_JJ) ($ICON_JJ_AT) ($info.change)(suffix $info.bookmarks)(suffix (jj-flags $info))"
173 +def get_vcs_path [] {
174 + let vcs = (find-vcs)
175 + if $vcs == null { return null }
177 + if $vcs.kind == $VCS_JJ { jj-segment $vcs.root } else { git-segment $vcs.git_dir }
180 +def path-segment [] {
181 + let home = if $env.HOME? != null { $env.HOME? } else { $env.USERPROFILE? }
182 + let notes = if $env.NOTES? != null { $env.NOTES? } else if $home != null { $home | path join $NOTES_DIR } else { null }
183 + let workspace = if $env.WORKSPACE? != null { $env.WORKSPACE? } else if $home != null { $home | path join $WORKSPACE_DIR } else { null }
185 + mut path = ($env.PWD | path expand)
186 + if $notes != null { $path = ($path | str replace $notes $ICON_NOTES) }
187 + if $workspace != null { $path = ($path | str replace $workspace $ICON_WORKSPACE) }
188 + if $home != null { $path = ($path | str replace $home $ICON_HOME) }
190 + if ($path | path split | length) >= $TRUNCATE_DEPTH {
191 + $path | path dirname --num-levels 2 --replace $TRUNCATE_SYMBOL
192 + } else {
193 + $path
47 197 def create_left_prompt [] {
48 - # normalize path
49 - let pwd = ($env.PWD | path expand)
50 - let pwd = ( (icons) | reduce --fold $pwd { |item, accumulator| $accumulator | str replace $item.path $item.icon })
51 - let truncate_level = 5
52 - let truncate_symbol = $"…(char path_sep)"
53 - let path_segment = if ($pwd | path split | length) >= $truncate_level { ($pwd | path dirname --num-levels 2 --replace $truncate_symbol ) } else { $pwd }
55 - let vcs_segment = (get_vcs_path)
58 - (ansi dark_gray)
59 - $path_segment
60 - (ansi reset)
61 - (ansi green)
62 - $vcs_segment
63 - (ansi reset)
199 + $ANSI_DARK_GRAY
200 + (path-segment)
201 + $ANSI_RESET
202 + $ANSI_GREEN
203 + (get_vcs_path)
204 + $ANSI_RESET
64 205 ] | str join
67 208 def create_right_prompt [] {
68 - let command_status_segment = if $env.LAST_EXIT_CODE == 0 { $" (char -u '2713') " } else { $"(ansi red) (char failed) (ansi reset)" }
209 + let status = if (($env.LAST_EXIT_CODE? | default 0) == 0) { $" ($ICON_CHECK) " } else { $"($ANSI_RED) ($ICON_FAILED) ($ANSI_RESET)" }
71 - (ansi dark_gray_dimmed)
72 - $command_status_segment
73 - (ansi reset)
212 + $ANSI_DARK_GRAY_DIMMED
213 + $status
214 + $ANSI_RESET
74 215 ] | str join
77 218 export-env {
78 - # Use nushell functions to define your right and left prompt
79 - $env.PROMPT_COMMAND = { || create_left_prompt }
80 - $env.PROMPT_COMMAND_RIGHT = { || create_right_prompt }
82 - # The prompt indicators are environmental variables that represent
83 - # the state of the prompt
84 - $env.PROMPT_INDICATOR = $"(ansi green) ⚈ (ansi reset)"
85 - $env.PROMPT_INDICATOR_VI_INSERT = $"(ansi magenta) (char pipe) (ansi reset)"
86 - $env.PROMPT_INDICATOR_VI_NORMAL = $"(ansi magenta) (char prompt) (ansi reset)"
87 - $env.PROMPT_MULTILINE_INDICATOR = $"(ansi magenta) (char prompt)(char prompt) (ansi reset)"
219 + $env.PROMPT_COMMAND = { || create_left_prompt }
220 + $env.PROMPT_COMMAND_RIGHT = { || create_right_prompt }
221 + $env.PROMPT_INDICATOR = $PROMPT_INDICATOR_TEXT
222 + $env.PROMPT_INDICATOR_VI_INSERT = $PROMPT_INSERT_TEXT
223 + $env.PROMPT_INDICATOR_VI_NORMAL = $PROMPT_NORMAL_TEXT
224 + $env.PROMPT_MULTILINE_INDICATOR = $PROMPT_MULTILINE_TEXT

nushell/secrets.nu

Added
new file mode 100644

Current version contains binary or non-UTF-8 data.

termux.symlinks

Modified
46 46 nushell/modules
47 47 ~/.config/nushell/modules
49 -nushell/completions
50 -~/.config/nushell/completions
52 49 ssh/config
53 50 ~/.ssh/config

x230.symlinks

Modified
49 49 nushell/gen-aliases.nu
50 50 ~/.config/nushell/gen-aliases.nu
52 -nushell/gen-secrets.nu
53 -~/.config/nushell/gen-secrets.nu
52 +nushell/secrets.nu
53 +~/.config/nushell/secrets.nu
55 55 nushell/modules
56 56 ~/.config/nushell/modules
85 85 pueue/pueued.service
86 86 ~/.config/systemd/user/pueued.service
88 -firefox/profiles.ini
89 -~/.mozilla/firefox/profiles.ini
91 -firefox/qrza8u52.default-release/user.js
92 -~/.mozilla/firefox/qrza8u52.default-release/user.js
94 88 psd/psd.conf
95 89 ~/.config/psd/psd.conf