repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

Clean Nushell config directory

19f9f846dc08efa3e1f15b5550e14126dfd6d4fc

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (7)

nushell/.gitignore

Modified
1 -aliases.nu
2 -carapace.nu
3 1 history.*
4 -plugin.nu
5 -zoxide.nu
6 -vendor/
2 +plugin.*

nushell/config.nu

Modified
72 72 $env.config.use_kitty_protocol = (not $env.WIN32)
73 73 $env.config.history.file_format = "sqlite"
74 74 $env.config.history.isolation = true
75 +$env.config.history.path = ($nu.data-dir | path join "history.sqlite3")
76 77 source ($nu.default-config-dir | path join "theme.nu")

nushell/env.nu

Deleted
deleted file mode 100644
1 -# Intentionally empty.
2 -#
3 -# Modern Nushell config keeps environment setup in config.nu and late-loading
4 -# local/session tweaks in autoload/*.nu.

nushell/test_shim/file3.txt

Deleted
deleted file mode 100644

nushell/test_shim/original.txt

Deleted
deleted file mode 100644
1 -hello world

nushell/test_shim_edge_cases.nu

Deleted
deleted file mode 100644
1 -#!/usr/bin/env nu
2 -# Comprehensive test suite for shim module
3 -# Run with: nu test_shim_edge_cases.nu
5 -use ./modules/shim.nu
7 -print "=== SHIM MODULE EDGE CASE TESTS ==="
8 -print ""
10 -# Helper to check if path is file
11 -def check_is_file [] {
12 - let p = $in
13 - try { ($p | path type) == file } catch { false }
16 -# Helper to check if path is symlink
17 -def check_is_symlink [] {
18 - let p = $in
19 - try { ($p | path type) == symlink } catch { false }
22 -# Clean up helper
23 -def cleanup [] {
24 - do --ignore-errors { shim unlink "/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt" }
25 - do --ignore-errors { shim unlink "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" }
26 - do --ignore-errors { rm "/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt" }
27 - do --ignore-errors { rm "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" }
28 - do --ignore-errors { rm "/home/oli/Workspace/dotfiles/nushell/test_shim/moved1.txt" }
29 - do --ignore-errors { rm "/home/oli/Workspace/dotfiles/nushell/test_shim/moved2.txt" }
30 - do --ignore-errors { rm "/home/oli/Workspace/dotfiles/nushell/test_shim/subdir/file2.txt" }
31 - do --ignore-errors { rmdir "/home/oli/Workspace/dotfiles/nushell/test_shim/subdir" }
34 -# Initial cleanup
35 -cleanup
37 -print ""
38 -print "== Test 1: Basic link and unlink =="
39 -echo "test1 content" | save --force "/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt"
40 -shim link "/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt" "/home/oli/Workspace/dotfiles/nushell/test_shim/moved1.txt"
41 -let t1_is_symlink = ("/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt" | check_is_symlink)
42 -let t1_content = (cat "/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt" | str trim)
43 -shim unlink "/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt"
44 -let t1_is_file = ("/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt" | check_is_file)
45 -let t1_restored = (cat "/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt" | str trim)
46 -if $t1_is_symlink and $t1_content == "test1 content" and $t1_is_file and $t1_restored == "test1 content" {
47 - print " [PASS]"
48 -} else {
49 - print " [FAIL]"
50 - print $" symlink: ($t1_is_symlink), content: ($t1_content), restored: ($t1_is_file), restored_content: ($t1_restored)"
53 -cleanup
55 -print ""
56 -print "== Test 2: Source doesn't exist =="
57 -let t2_pass = try { shim link /nonexistent/file.txt /tmp/dest; false } catch { true }
58 -if $t2_pass { print " [PASS]" } else { print " [FAIL]" }
59 -print " Expected error when source doesn't exist"
61 -cleanup
63 -print ""
64 -print "== Test 3: Source is already a symlink =="
65 -echo "content" | save --force "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
66 -shim link "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" "/home/oli/Workspace/dotfiles/nushell/test_shim/moved2.txt"
67 -let t3_pass = try { shim link "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" "/tmp/another.txt"; false } catch { true }
68 -shim unlink "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
69 -if $t3_pass { print " [PASS]" } else { print " [FAIL]" }
70 -print " Expected error when linking already-linked path"
72 -cleanup
74 -print ""
75 -print "== Test 4: Move into existing directory =="
76 -mkdir "/home/oli/Workspace/dotfiles/nushell/test_shim/subdir"
77 -echo "content" | save --force "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
78 -shim link "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" "/home/oli/Workspace/dotfiles/nushell/test_shim/subdir"
79 -let t4_in_subdir = (("/home/oli/Workspace/dotfiles/nushell/test_shim/subdir/file2.txt" | check_is_file))
80 -let t4_is_symlink = ("/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" | check_is_symlink)
81 -if $t4_in_subdir and $t4_is_symlink {
82 - print " [PASS]"
83 -} else {
84 - print " [FAIL]"
85 - print $" file in subdir: ($t4_in_subdir), symlink at original: ($t4_is_symlink)"
87 -shim unlink "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
88 -do --ignore-errors { rm "/home/oli/Workspace/dotfiles/nushell/test_shim/subdir/file2.txt" }
89 -do --ignore-errors { rmdir "/home/oli/Workspace/dotfiles/nushell/test_shim/subdir" }
91 -cleanup
93 -print ""
94 -print "== Test 5: Relative symlinks =="
95 -echo "relcontent" | save --force "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
96 -shim link "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" "/home/oli/Workspace/dotfiles/nushell/test_shim/moved2.txt" --relative
97 -let t5_target = (^readlink "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt")
98 -let t5_is_rel = not ($t5_target | str starts-with "/")
99 -let t5_content = (cat "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" | str trim)
100 -shim unlink "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
101 -if $t5_is_rel and $t5_content == "relcontent" {
102 - print " [PASS]"
103 -} else {
104 - print " [FAIL]"
105 - print $" target: ($t5_target), is_relative: ($t5_is_rel), content: ($t5_content)"
108 -cleanup
110 -print ""
111 -print "== Test 6: Dry-run mode =="
112 -echo "dryrun" | save --force "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
113 -shim link "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" "/tmp/dryrun.txt" --dry-run
114 -let t6_is_file = ("/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" | check_is_file)
115 -if $t6_is_file { print " [PASS]" } else { print " [FAIL]" }
116 -print " File unchanged after dry-run"
117 -cleanup
119 -print ""
120 -print "== Test 7: Quiet mode =="
121 -echo "quiet" | save --force "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
122 -let t7_out = (shim link "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" "/home/oli/Workspace/dotfiles/nushell/test_shim/moved2.txt" --quiet)
123 -let t7_empty = ($t7_out | is-empty) or ($t7_out | describe) == "nothing"
124 -shim unlink "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
125 -if $t7_empty { print " [PASS]" } else { print " [FAIL]" }
126 -print " No output from link command with --quiet"
128 -cleanup
130 -print ""
131 -print "== Test 8: Cross-filesystem relative =="
132 -echo "crossfs" | save --force "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
133 -let t8_pass = try { shim link "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" "/tmp/crossfs.txt" --relative; false } catch { true }
134 -cleanup
135 -if $t8_pass { print " [PASS]" } else { print " [FAIL]" }
136 -print " Expected error for cross-filesystem relative path"
138 -print ""
139 -print "=== ALL TESTS COMPLETE ==="

nushell/test_shim_simple.nu

Deleted
deleted file mode 100644
1 -#!/usr/bin/env nu
2 -# Simple test for shim module
4 -use ./modules/shim.nu
6 -print "=== SIMPLE SHIM TESTS ==="
8 -# Clean up
9 -do --ignore-errors { shim unlink /home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt }
10 -do --ignore-errors { shim unlink /home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt }
11 -do --ignore-errors { rm /home/oli/Workspace/dotfiles/nushell/test_shim/moved1.txt }
12 -do --ignore-errors { rm /home/oli/Workspace/dotfiles/nushell/test_shim/moved2.txt }
14 -print ""
15 -print "Test 1: Basic link/unlink"
16 -echo "hello" | save --force /home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt
17 -shim link /home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt /home/oli/Workspace/dotfiles/nushell/test_shim/moved1.txt
18 -let t1_type = ("/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt" | path type)
19 -print $" After link, type is: ($t1_type)"
20 -shim unlink /home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt
21 -let t1_type2 = ("/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt" | path type)
22 -print $" After unlink, type is: ($t1_type2)"
24 -print ""
25 -print "Test 2: Symlink detection"
26 -echo "test" | save --force /home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt
27 -shim link /home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt /home/oli/Workspace/dotfiles/nushell/test_shim/moved2.txt
28 -let t2_errored = try {
29 - shim link /home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt /tmp/dest
30 - false
31 -} catch { true }
32 -shim unlink /home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt
33 -print $" Error when linking existing symlink: ($t2_errored)"
35 -print ""
36 -print "Test 3: Relative symlinks"
37 -echo "relative" | save --force /home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt
38 -shim link /home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt /home/oli/Workspace/dotfiles/nushell/test_shim/moved2.txt --relative
39 -let t3_target = (^readlink /home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt)
40 -let t3_is_rel = not ($t3_target | str starts-with "/")
41 -shim unlink /home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt
42 -print $" Relative target: ($t3_target), is relative: ($t3_is_rel)"
44 -print ""
45 -print "=== DONE ==="