repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

nushell: replace deprecated let-env

12998409b5d1fd39175235122b4e9b7e64785aef

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (9)

helix/config.toml

Modified
1 -theme = "nugu-light"
1 +theme = "nugu-dark"
3 3 [editor]
4 4 shell = ["nu", "--commands"]

neovim/lazy-lock.json

Modified
3 3 "Comment.nvim": { "branch": "master", "commit": "e51f2b142d88bb666dcaa77d93a07f4b419aca70" },
4 4 "better-escape.nvim": { "branch": "master", "commit": "7031dc734add47bb71c010e0551829fa5799375f" },
5 5 "cmp-omni": { "branch": "main", "commit": "9436e6cdd7c5dfa24a99a60d9280b24dbdea3649" },
6 - "dressing.nvim": { "branch": "master", "commit": "e6eff7a5a950a853c3903d906dbcea03f778db5f" },
6 + "dressing.nvim": { "branch": "master", "commit": "c0b67f3e2950adc07b555d3e73e38275b4a585ce" },
7 7 "flash.nvim": { "branch": "main", "commit": "e5a7bd96d0bb7e0806bfc18adea5ab148165bd62" },
8 8 "gitsigns.nvim": { "branch": "main", "commit": "bb808fc7376ed7bac0fbe8f47b83d4bf01738167" },
9 9 "glow.nvim": { "branch": "main", "commit": "cf2177a514859fa3c55837b46de91d93b24cf488" },
11 11 "inc-rename.nvim": { "branch": "main", "commit": "ed0f6f2b917cac4eb3259f907da0a481b27a3b7e" },
12 12 "indent-blankline.nvim": { "branch": "master", "commit": "73640233cca0da8e01aced8c1f9e63fd892128b7" },
13 13 "lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" },
14 - "legendary.nvim": { "branch": "master", "commit": "67acc7d5ce7598ea159e1c689cc0f323bcbfb297" },
15 14 "lush.nvim": { "branch": "main", "commit": "a8f0f7b9f837887f13a61d67b40ae26188fe4d62" },
16 15 "neodev.nvim": { "branch": "main", "commit": "da1562e1e3df0e994ddc52cb4ba22376a5d7f2fc" },
17 16 "neogen": { "branch": "main", "commit": "cb1f384df804c1bf729332c4f728253fe17962d4" },
26 25 "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
27 26 "nvim-neoclip.lua": { "branch": "main", "commit": "4e406ae0f759262518731538f2585abb9d269bac" },
28 27 "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" },
29 - "nvim-surround": { "branch": "main", "commit": "211eaad7c6d01ef4ac02cba9052b3082ec232101" },
30 - "nvim-treesitter": { "branch": "master", "commit": "8d5e5dc40a4c480483690777cefb8cf67e710702" },
28 + "nvim-surround": { "branch": "main", "commit": "0d6882635817a2677749a330127d12ac30a4f3c8" },
29 + "nvim-treesitter": { "branch": "master", "commit": "80cee52d445363c8bd08eacca17be31e3837f4d0" },
31 30 "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
32 31 "nvim-ts-context-commentstring": { "branch": "main", "commit": "e9062e2dfb9854e6a927370f2d720de354c88524" },
33 - "nvim-web-devicons": { "branch": "master", "commit": "efbfed0567ef4bfac3ce630524a0f6c8451c5534" },
34 - "oil.nvim": { "branch": "master", "commit": "0138a2e0f9baacd98d5531ebb5078fafc5114fae" },
32 + "nvim-web-devicons": { "branch": "master", "commit": "eb8f80f30fd5e9a6176dee5c46661ebd7437ac46" },
33 + "oil.nvim": { "branch": "master", "commit": "0e5fca35cdc743cf3a448cea1a6251cf25cebafa" },
35 34 "persistence.nvim": { "branch": "main", "commit": "adcf6913693a0434665d162ee45a186230496f8a" },
36 35 "playground": { "branch": "master", "commit": "2b81a018a49f8e476341dfcb228b7b808baba68b" },
37 36 "plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" },
42 41 "telescope.nvim": { "branch": "0.1.x", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" },
43 42 "todo-comments.nvim": { "branch": "main", "commit": "8febc60a76feefd8203077ef78b6a262ea1a41f9" },
44 43 "toggleterm.nvim": { "branch": "main", "commit": "b90a1381e9b5b8596f49070ee86c71db267ac868" },
45 - "treesj": { "branch": "main", "commit": "a0f32947556560f700d2728ad1c87f4257faab38" },
44 + "treesj": { "branch": "main", "commit": "00b382dc81eefaf42ad50a521e368f9057815bfb" },
46 45 "twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" },
47 46 "virt-column.nvim": { "branch": "master", "commit": "1917bfb519729dea7b4f5d13aa9c810c9579b0ea" },
48 47 "zen-mode.nvim": { "branch": "main", "commit": "6e6c963d70a8e47854fa656987666bfb863f9c4e" }

nushell/config.nu

Modified
4 4 # Nushell Config File
5 5 use table.nu *
6 6 use os.nu *
7 7 use prompt.nu *
8 8 use aliases.nu *
9 9 use todo.nu
10 -use git.nu *
11 -use svn.nu *
12 10 use openssl.nu *
13 11 use pacnew.nu
14 12 use syncthing.nu
66 64 # The default config record. This is where much of your global configuration is setup.
67 -let-env config = {
65 +$env.config = {
68 66 show_banner: false
69 67 table: {
70 68 mode: light # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other
290 288 use zoxide.nu *
292 290 overlay use coreutils.nu

nushell/env.nu

Modified
1 1 # GLOBAL VARIABLES
3 -let-env WIN32 = ( $nu.os-info.name =~ "windows" )
4 -let-env NURC_DIR = ( $nu.config-path | path expand | path dirname )
5 -let-env DOTFILES = ( $env.NURC_DIR | path join ".." | path expand )
6 -let-env WORKSPACE = if $env.WIN32 { "W:/" } else { "~/Workspace" | path expand }
7 -let-env NOTES = if $env.WIN32 { "N:/" } else { "~/Notes" | path expand }
3 +$env.WIN32 = ( $nu.os-info.name =~ "windows" )
4 +$env.NURC_DIR = ( $nu.config-path | path expand | path dirname )
5 +$env.DOTFILES = ( $env.NURC_DIR | path join ".." | path expand )
6 +$env.WORKSPACE = if $env.WIN32 { "W:/" } else { "~/Workspace" | path expand }
7 +$env.NOTES = if $env.WIN32 { "N:/" } else { "~/Notes" | path expand }
9 -let-env TERM = if ($env | get -i TERM_PROGRAM) == WezTerm { "wezterm" } else { "xterm-256color" }
9 +$env.TERM = if ($env | get -i TERM_PROGRAM) == WezTerm { "wezterm" } else { "xterm-256color" }
11 -let-env PATH = ($env.PATH | prepend ( if $env.WIN32 { [] } else { [ $"($env.WORKSPACE)/tools", $"($env.HOME)/.cargo/bin" ] } ))
11 +$env.PATH = ($env.PATH | prepend ( if $env.WIN32 { [] } else { [ $"($env.WORKSPACE)/tools", $"($env.HOME)/.cargo/bin" ] } ))
13 13 # theme for ls and other programs, that use LS_COLORS
14 -# let-env LS_COLORS = ( try { vivid generate nord } catch { "" } )
14 +# $env.LS_COLORS = ( try { vivid generate nord } catch { "" } )
16 16 # Specifies how environment variables are:
17 17 # - converted from a string to a value on Nushell startup (from_string)
18 18 # - converted from a value back to a string when running external commands (to_string)
19 19 # Note: The conversions happen *after* config.nu is loaded
20 -let-env ENV_CONVERSIONS = {
20 +$env.ENV_CONVERSIONS = {
21 21 "PATH": {
22 22 from_string: { |s| $s | split row (char esep) }
23 23 to_string: { |v| $v | str join (char esep) }
31 31 # Directories to search for scripts when calling source or use
32 -let-env NU_LIB_DIRS = [
32 +$env.NU_LIB_DIRS = [
33 33 ($nu.config-path | path dirname | path join 'modules'),
34 34 ($nu.config-path | path dirname | path join 'completions')
35 -]

nushell/modules/aliases.nu

Modified
24 24 # TODO: HOST SPECIFIC ALIASES
25 25 # I do not see a way right now the have different aliases per host with nu.
27 -# update windows user environment variables
28 -alias ue = let-env Path = (do $env.ENV_CONVERSIONS.Path.from_string (powershell -C '[System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::User)') | append $env.Path | flatten | uniq)
30 27 # CUSTOM LITTLE JAVA COMMANDS
31 28 export alias aes = java ($env.DOTFILES + /tools/ + aes.java)
32 29 export alias download = java ($env.DOTFILES + /tools/ + download.java)

nushell/modules/git.nu

Deleted
deleted file mode 100644
1 -export def github-upload-key [
2 - title: string # Name the key, so you will remember what it is used for
3 - key: path # Path to the PUBLIC key
4 -] {
5 - if ($key | path exists) {
6 - echo (build-string "uploading ssh public key " (ansi gi) $key (ansi reset) " with title " (ansi gb) $title (ansi reset) " to GitHub.")
7 - echo (char newline)
8 - let encrypted_token_path = (build-string $env.DOTFILES / tresor / 4cef0ce3-da3a-4f16-9412-2d094b4f7445)
9 - let decrypted_token_path = (build-string $env.DOTFILES / tresor / gh_token)
10 - aes decrypt $encrypted_token_path $decrypted_token_path
11 - let token = (open --raw $decrypted_token_path)
12 - let key_content = (open --raw $key)
13 - rm -f $decrypted_token_path
14 - let result = (do -i { xh --bearer $token https://api.github.com/user/keys (build-string title = $title) (build-string key = $key_content) | from json})
15 - if ($result | has-column? errors) {
16 - let message = ($result | get message)
17 - let url = ($result | get documentation_url)
18 - let errors = ($result | get errors)
19 - echo (build-string (ansi rb) $message (ansi reset) (char newline))
20 - echo (char newline)
21 - $errors | each {
22 - | it |
23 - let resource = ($it | get resource)
24 - let code = ($it | get code)
25 - let field = ($it | get field)
26 - let message = ($it | get message)
27 - echo (build-string (ansi ui) $resource : $code : $field ": " (ansi rb) $message (ansi reset) (char newline))
28 - }
29 - echo (build-string "Further information: " (ansi yi) $url (ansi reset) (char newline))
30 - } else {
31 - let id = ($result | get id)
32 - let key = ($result | get key)
33 - let title = ($result | get title)
34 - let created_at = ($result | get created_at)
35 - echo (build-string "[" ID : $id "]" " key with title " (ansi gb) $title (ansi reset) " was created at " (ansi yi) $created_at (ansi reset) "." (char newline) )
36 - echo (build-string (ansi wu) "PUBLIC SSH KEY:" (ansi reset))
37 - echo (char newline)
38 - echo ($key | ansi gradient --fgstart "0xaefe9f" --fgend "0xfefefe")
39 - echo (char newline)
40 - }
41 - } else {
42 - echo (build-string "key " (ansi rb) $key (ansi reset) " not found!")
43 - echo (char newline)
44 - }
45 -}
47 -# Shows git log in a pretty table
48 -export def glog [
49 - ...rest: string # Extra arguments to git log
50 -] {
51 - git log --pretty=%h»¦«%s»¦«%aN»¦«%aE»¦«%aD -n 25 $rest | lines | split column "»¦«" commit subject name email date | update date { || get date | into datetime } | sort-by date
52 -}
54 -# Show the effective configuration of git
55 -export def git-effective-config [] {
56 - git config --list --show-origin
57 -}
59 -export alias ghead = git rev-parse HEAD

nushell/modules/prompt.nu

Modified
95 95 export-env {
96 96 # Use nushell functions to define your right and left prompt
97 - let-env PROMPT_COMMAND = { || create_left_prompt }
98 - let-env PROMPT_COMMAND_RIGHT = { || create_right_prompt }
97 + $env.PROMPT_COMMAND = { || create_left_prompt }
98 + $env.PROMPT_COMMAND_RIGHT = { || create_right_prompt }
100 100 # The prompt indicators are environmental variables that represent
101 101 # the state of the prompt
102 - let-env PROMPT_INDICATOR = $"(ansi green) (char prompt) (ansi reset)"
103 - let-env PROMPT_INDICATOR_VI_INSERT = $"(ansi magenta) (char pipe) (ansi reset)"
104 - let-env PROMPT_INDICATOR_VI_NORMAL = $"(ansi magenta) (char prompt) (ansi reset)"
105 - let-env PROMPT_MULTILINE_INDICATOR = $"(ansi magenta) (char prompt)(char prompt) (ansi reset)"
102 + $env.PROMPT_INDICATOR = $"(ansi green) (char prompt) (ansi reset)"
103 + $env.PROMPT_INDICATOR_VI_INSERT = $"(ansi magenta) (char pipe) (ansi reset)"
104 + $env.PROMPT_INDICATOR_VI_NORMAL = $"(ansi magenta) (char prompt) (ansi reset)"
105 + $env.PROMPT_MULTILINE_INDICATOR = $"(ansi magenta) (char prompt)(char prompt) (ansi reset)"

nushell/modules/svn.nu

Deleted
deleted file mode 100644
1 -def get-item-status-count [
2 - svn_status: table # svn status table from xml
3 - item_status_filter: string # the path item status to count
4 -] {
5 - let target_status_count = ( $svn_status | get status.children.target.children.entry.children.wc-status.attributes | compact | flatten | flatten | where item == $item_status_filter | length )
6 - # there will always be a "target" node, but "changelist" is optional
7 - let changelist_status_count = ( $svn_status | get --ignore-errors status.children.changelist.children.entry.children.wc-status.attributes | compact | flatten | flatten | where item == $item_status_filter | length )
8 - $target_status_count + $changelist_status_count
9 -}
11 -# Aggregates the output of `svn status` and `svn info` into a table.
12 -# This command operates in the current directory.
13 -# Analog to gstat for svn.
14 -export def-env svnstat [
15 - ...path: string # optional paths to get svn status from. If empty, the current directory is assumed.
16 -] {
17 - # the svn info and status commands can handle multiple input paths.
18 - # TODO empty values, when not in svn directory
19 - let svn_status = (^svn status --xml $path | from xml)
20 - let svn_info = (^svn info --xml $path | from xml)
21 - {
22 - "path": ( $svn_info | get info.children.entry.attributes.path | path expand )
23 - "working_copy_root_path": ( $svn_info | get info.children.entry.children.wc-info.children.wcroot-abspath.children | flatten | flatten | flatten | compact )
24 - "url": ( $svn_info | get info.children.entry.children.url.children | flatten | flatten | compact )
25 - "relative_url": ( $svn_info | get info.children.entry.children.relative-url.children | flatten | flatten | compact )
26 - "repository_root": ( $svn_info | get info.children.entry.children.repository.children.root.children | flatten | flatten | flatten | compact )
27 - "repository_uuid": ( $svn_info | get info.children.entry.children.repository.children.uuid.children | flatten | flatten | flatten | compact )
28 - "revision": ( $svn_info | get info.children.entry.attributes.revision )
29 - "node_kind": ( $svn_info | get info.children.entry.attributes.kind )
30 - "schedule": ( $svn_info | get info.children.entry.children.wc-info.children.schedule.children | flatten | flatten | flatten | compact )
31 - "last_changed_author": ( $svn_info | get info.children.entry.children.commit.children.author.children | flatten | flatten | flatten | compact )
32 - "last_changed_rev": ( $svn_info | get info.children.entry.children.commit.attributes.revision | flatten | compact )
33 - "last_changed_date": ( $svn_info | get info.children.entry.children.commit.children.date.children | flatten | flatten | flatten | compact| into datetime )
34 - "added": ( get-item-status-count $svn_status "added" )
35 - "conflicted": "TODO"
36 - "deleted": ( get-item-status-count $svn_status "deleted" )
37 - "ignored": ( get-item-status-count $svn_status "ignored" )
38 - "modified": ( get-item-status-count $svn_status "modified" )
39 - "replaced": "TODO"
40 - "unversioned_external": "TODO"
41 - "unversioned": ( get-item-status-count $svn_status "unversioned" )
42 - "missing": ( get-item-status-count $svn_status "missing" )
43 - "obstructed": "TODO"
44 - "tree_conflicts": ( $svn_status | get --ignore-errors status.children.target.children.entry.children.wc-status.attributes.tree-conflicted | flatten | flatten | compact | length)
45 - "changelists": ( $svn_status | get --ignore-errors status.children.changelist | compact | flatten | get --ignore-errors name )
46 - }
47 -}

nushell/modules/zoxide.nu

Modified
8 8 # Initialize hook to add new entries to the database.
9 9 export-env {
10 - let-env config = ($env | default {} config).config
11 - let-env config = ($env.config | default {} hooks)
12 - let-env config = ($env.config | update hooks ($env.config.hooks | default [] pre_prompt))
13 - let-env config = ($env.config | update hooks.pre_prompt ($env.config.hooks.pre_prompt | append { ||
10 + $env.config = ($env | default {} config).config
11 + $env.config = ($env.config | default {} hooks)
12 + $env.config = ($env.config | update hooks ($env.config.hooks | default [] pre_prompt))
13 + $env.config = ($env.config | update hooks.pre_prompt ($env.config.hooks.pre_prompt | append { ||
14 14 zoxide add -- $env.PWD
57 57 # source ~/.zoxide.nu
59 -# Note: zoxide only supports Nushell v0.63.0 and above.
59 +# Note: zoxide only supports Nushell v0.63.0 and above.