repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

nushell: update to version 0.64.0 parser changed slightly, in maybe buggy ways. reported issues and worked around the changes

9d806f8f149eb75c7046d8f90d845e8b2c9c0556

Oliver Krylow <o.krylow@isp-insoft.de> ·

unsigned

Browse filesCompare with HEAD

Changed files (5)

nushell/completions/svn-completions.nu

Added
new file mode 100644
1 +def "complete svn subcommands" [] {
2 + ^svn help
3 + | lines
4 + | skip until { | line | $line | str starts-with "Available subcommands:" }
5 + | skip 1
6 + | each { |line| $line | str trim }
7 + | take until { |line| $line | empty? }
8 + | split column " "
9 + | get column1
12 +# TODO: parse xml output
14 +def "complete svn add paths" [] {
15 + ^svn status --depth files
16 + | lines
17 + | parse "{mode} {file}"
18 + | str trim
19 + | where mode == ?
20 + | get file
23 +def "complete svn revert paths" [] {
24 + ^svn status --depth files
25 + | lines
26 + | parse "{mode} {file}"
27 + | where mode == M
28 + | str trim
29 + | get file
32 +def "complete svn depth" [] { ['empty', 'files', 'immediates', 'infinity'] }
34 +def "complete svn changelists" [] {
35 + ^svn status --depth files
36 + | lines
37 + | parse "--- Changelist '{changelist}':"
38 + | get --ignore-errors changelist
41 +# Subversion is a tool for version control.
42 +# For additional information, see http://subversion.apache.org/
43 +export extern svn [
44 + subcommand?: string@"complete svn subcommands" # for help on a specific subcommand.
45 + --version # to see the program version and RA modules
46 + --quiet # to see just the version number
47 + --verbose # to see dependency versions as well
50 +# help (?, h): Describe the usage of this program or its subcommands.
51 +# usage: help [SUBCOMMAND...]
52 +export extern "svn help" [
53 + subcommand?: string@"complete svn subcommands" # for help on a specific subcommand.
54 + --verbose(-v) # also show experimental subcommands and options
57 +# FIXME:
58 +# SVN has short options with double dashes: --changelist(--cl).
59 +# This is not allowed in nu.
61 +# FIXME:
62 +# Multiline doccomments will be rendered without the newlines.
64 +# Print the status of working copy files and directories.
65 +export extern "svn status" [
66 + ...paths: path # PATHs
67 + --show-updates(-u) # display update information
68 + --verbose(-v) # print extra information
69 + --depth: string@"complete svn depth" # limit operation by depth ARG ('empty', 'files', 'immediates', or 'infinity')
70 + --revision(-r): string # ARG (some commands also take ARG1:ARG2 range)
71 + # A revision argument can be one of:
72 + # NUMBER revision number
73 + # '{' DATE '}' revision at start of the date
74 + # 'HEAD' latest in repository
75 + # 'BASE' base rev of item's working copy
76 + # 'COMMITTED' last commit at or before BASE
77 + # 'PREV' revision just before COMMITTED
78 + --quiet(-q) # don't print unversioned items
79 + --no-ignore # disregard default and svn:ignore and svn:global-ignores property ignores
80 + --incremental # give output suitable for concatenation
81 + --xml # output in XML
82 + --ignore-externals # ignore externals definitions
83 + --changelist:string@"complete svn changelists" # operate only on members of changelist ARG
86 +# FIXME: https://github.com/nushell/nushell/issues/5012
87 +# rest parameters do not play well with completions yet
88 +# the `paths` parameter should be `...paths`
90 +# Put new files and directories under version control.
91 +export extern "svn add" [
92 + paths: path@"complete svn add paths" # unversioned PATHs for addition
93 + --targets: path # pass contents of file ARG as additional args
94 + --non-recursive(-N) # obsolete; same as --depth=empty
95 + --depth: string@"complete svn depth" # limit operation by depth ARG ('empty', 'files', 'immediates', or 'infinity')
96 + --quiet(-q) # print nothing, or only summary information
97 + --force # ignore already versioned paths
98 + --no-ignore # disregard default and svn:ignore and svn:global-ignores property ignores
99 + --auto-props # enable automatic properties
100 + --no-auto-props # disable automatic properties
101 + --parents # add intermediate parents
104 +# Restore pristine working copy state (undo local changes).
105 +export extern "svn revert" [
106 + paths: path@"complete svn revert paths"
107 + --targets: path # pass contents of file as additional args
108 + --recursive(-R) # descend recursively, same as --depth=infinity
109 + --depth: string@"complete svn depth" # limit operation by depth ARG ('empty', 'files', 'immediates', or 'infinity')
110 + --quiet(-q) # print nothing, or only summary information
111 + --changelist: string@"complete svn changelists" # operate only on members of changelist ARG
112 + --remove-added # reverting an added item will remove it from disk
115 +# FIXME
116 +# SVN uses aliases for subcommands. E.g. `co` for `checkout`.
117 +# How to express that with nu extern commands?
119 +# Check out a working copy from a repository.
120 +export extern "svn checkout" [
121 + ...url_with_rev:string # source
122 + path: path # destination
123 + --revision(-r) # ARG (some commands also take ARG1:ARG2 range)
124 + # A revision argument can be one of:
125 + # NUMBER revision number
126 + # '{' DATE '}' revision at start of the date
127 + # 'HEAD' latest in repository
128 + # 'BASE' base rev of item's working copy
129 + # 'COMMITTED' last commit at or before BASE
130 + # 'PREV' revision just before COMMITTED
131 + --quiet(-q) # print nothing, or only summary information
132 + --depth: string@"complete svn depth" # limit operation by depth ARG ('empty', 'files', 'immediates', or 'infinity')
133 + --force # force operation to run
134 + --ignore-externals # ignore externals definitions

nushell/completions/svn.complete.nu

Deleted
deleted file mode 100644
1 -def "complete svn subcommands" [] {
2 - ^svn help
3 - | lines
4 - | skip until { | line | $line | str starts-with "Available subcommands:" }
5 - | skip 1
6 - | each { |line| $line | str trim }
7 - | take until { |line| $line | empty? }
8 - | split column " "
9 - | get column1
12 -# TODO: parse xml output
14 -def "complete svn add paths" [] {
15 - ^svn status --depth files
16 - | lines
17 - | parse "{mode} {file}"
18 - | str trim
19 - | where mode == ?
20 - | get file
23 -def "complete svn revert paths" [] {
24 - ^svn status --depth files
25 - | lines
26 - | parse "{mode} {file}"
27 - | where mode == M
28 - | str trim
29 - | get file
32 -def "complete svn depth" [] { ['empty', 'files', 'immediates', 'infinity'] }
34 -def "complete svn changelists" [] {
35 - ^svn status --depth files
36 - | lines
37 - | parse "--- Changelist '{changelist}':"
38 - | get --ignore-errors changelist
41 -# Subversion is a tool for version control.
42 -# For additional information, see http://subversion.apache.org/
43 -export extern svn [
44 - subcommand?: string@"complete svn subcommands" # for help on a specific subcommand.
45 - --version # to see the program version and RA modules
46 - --quiet # to see just the version number
47 - --verbose # to see dependency versions as well
50 -# help (?, h): Describe the usage of this program or its subcommands.
51 -# usage: help [SUBCOMMAND...]
52 -export extern "svn help" [
53 - subcommand?: string@"complete svn subcommands" # for help on a specific subcommand.
54 - --verbose(-v) # also show experimental subcommands and options
57 -# FIXME:
58 -# SVN has short options with double dashes: --changelist(--cl).
59 -# This is not allowed in nu.
61 -# FIXME:
62 -# Multiline doccomments will be rendered without the newlines.
64 -# Print the status of working copy files and directories.
65 -export extern "svn status" [
66 - ...paths: path # PATHs
67 - --show-updates(-u) # display update information
68 - --verbose(-v) # print extra information
69 - --depth: string@"complete svn depth" # limit operation by depth ARG ('empty', 'files', 'immediates', or 'infinity')
70 - --revision(-r): string # ARG (some commands also take ARG1:ARG2 range)
71 - # A revision argument can be one of:
72 - # NUMBER revision number
73 - # '{' DATE '}' revision at start of the date
74 - # 'HEAD' latest in repository
75 - # 'BASE' base rev of item's working copy
76 - # 'COMMITTED' last commit at or before BASE
77 - # 'PREV' revision just before COMMITTED
78 - --quiet(-q) # don't print unversioned items
79 - --no-ignore # disregard default and svn:ignore and svn:global-ignores property ignores
80 - --incremental # give output suitable for concatenation
81 - --xml # output in XML
82 - --ignore-externals # ignore externals definitions
83 - --changelist:string@"complete svn changelists" # operate only on members of changelist ARG
86 -# FIXME: https://github.com/nushell/nushell/issues/5012
87 -# rest parameters do not play well with completions yet
88 -# the `paths` parameter should be `...paths`
90 -# Put new files and directories under version control.
91 -export extern "svn add" [
92 - paths: path@"complete svn add paths" # unversioned PATHs for addition
93 - --targets: path # pass contents of file ARG as additional args
94 - --non-recursive(-N) # obsolete; same as --depth=empty
95 - --depth: string@"complete svn depth" # limit operation by depth ARG ('empty', 'files', 'immediates', or 'infinity')
96 - --quiet(-q) # print nothing, or only summary information
97 - --force # ignore already versioned paths
98 - --no-ignore # disregard default and svn:ignore and svn:global-ignores property ignores
99 - --auto-props # enable automatic properties
100 - --no-auto-props # disable automatic properties
101 - --parents # add intermediate parents
104 -# Restore pristine working copy state (undo local changes).
105 -export extern "svn revert" [
106 - paths: path@"complete svn revert paths"
107 - --targets: path # pass contents of file as additional args
108 - --recursive(-R) # descend recursively, same as --depth=infinity
109 - --depth: string@"complete svn depth" # limit operation by depth ARG ('empty', 'files', 'immediates', or 'infinity')
110 - --quiet(-q) # print nothing, or only summary information
111 - --changelist: string@"complete svn changelists" # operate only on members of changelist ARG
112 - --remove-added # reverting an added item will remove it from disk
115 -# FIXME
116 -# SVN uses aliases for subcommands. E.g. `co` for `checkout`.
117 -# How to express that with nu extern commands?
119 -# Check out a working copy from a repository.
120 -export extern "svn checkout" [
121 - ...url_with_rev:string # source
122 - path: path # destination
123 - --revision(-r) # ARG (some commands also take ARG1:ARG2 range)
124 - # A revision argument can be one of:
125 - # NUMBER revision number
126 - # '{' DATE '}' revision at start of the date
127 - # 'HEAD' latest in repository
128 - # 'BASE' base rev of item's working copy
129 - # 'COMMITTED' last commit at or before BASE
130 - # 'PREV' revision just before COMMITTED
131 - --quiet(-q) # print nothing, or only summary information
132 - --depth: string@"complete svn depth" # limit operation by depth ARG ('empty', 'files', 'immediates', or 'infinity')
133 - --force # force operation to run
134 - --ignore-externals # ignore externals definitions

nushell/env.nu

Modified
1 1 # GLOBAL VARIABLES
3 -let-env WIN32? = $nu.os-info.name =~ "windows"
3 +let-env WIN32? = ( $nu.os-info.name =~ "windows" )
4 4 let-env NURC_DIR = ( $nu.config-path | path expand | path dirname )
5 5 let-env DOTFILES = ( $env.NURC_DIR | path join ".." | path expand )
6 6 let-env WORKSPACE = if $env.WIN32? { "W:/" } else { "~/Workspace" | path expand }

tools/cargo-tools.nu

Modified
5 5 # we also cannot use `cargo install --list` to search for the binary name, in case the crate
6 6 # is not installed yet
7 7 let cargo_crates = [
8 - [name bin features];
9 - ["sccache" "sccache" []]
10 - ["nu" "nu" ["--features=extra"]]
11 - ["sd" "sd" []]
12 - ["cbs" "cbs" []]
13 - ["ouch" "ouch" []]
14 - ["fd-find" "fd" []]
15 - ["choose", "choose", []]
16 - ["ripgrep" "rg" []]
17 - ["onefetch" "onefetch" []]
18 - ["eva" "eva" []]
19 - ["mdcat" "mdcat" []]
20 - ["cargo-update" "cargo-install-update" []]
21 - ["hexyl" "hexyl" []]
22 - ["hyperfine" "hyperfine" []]
23 - ["so" "so" so-features]
24 - ["tealdeer" "tldr" []]
25 - ["tokei" "tokei" []]
26 - ["bat" "bat" []]
27 - ["pastel" "pastel" []]
28 - ["diskonaut" "diskonaut" []]
29 - ["menyoki" "menyoki" []]
30 - ["zoxide" "zoxide" []]
31 - ["grex" "grex" []]
32 - ["xh" "xh" []]
33 - ["comrak" "comrak" []]
34 - # ["bandwhich" "bandwhich" []] masked until https://github.com/imsnif/bandwhich/issues/233
35 - ["lychee" "lychee" []]
36 - ["viu" "viu" []]
37 - ["licensor" "licensor" []]
38 - ["gib" "gib" []]
39 - ["silicon" "silicon" []]
40 - ["bottom" "btm" []]
41 - ["sic" "sic" []]
42 - ["just" "just" []]
43 - ["mdsh" "mdsh" []]
44 - ["git-delta" "delta" []]
45 - ["selene" "selene" ["--no-default-features"]]
46 - ["stylua" "stylua" ["--features=lua52"]]
47 - ["taplo-cli" "taplo" []]
8 + [ name bin features];
9 + [ "sccache" "sccache" [] ]
10 + [ "nu" "nu" [ "--features" "extra" ] ]
11 + [ "sd" "sd" [] ]
12 + [ "cbs" "cbs" [] ]
13 + [ "ouch" "ouch" [] ]
14 + [ "fd-find" "fd" [] ]
15 + [ "choose", "choose", [] ]
16 + [ "ripgrep" "rg" [] ]
17 + [ "onefetch" "onefetch" [] ]
18 + [ "eva" "eva" [] ]
19 + [ "mdcat" "mdcat" [] ]
20 + [ "cargo-update" "cargo-install-update" [] ]
21 + [ "hexyl" "hexyl" [] ]
22 + [ "hyperfine" "hyperfine" [] ]
23 + [ "so" "so" (so-features) ]
24 + [ "tealdeer" "tldr" [] ]
25 + [ "tokei" "tokei" [] ]
26 + [ "bat" "bat" [] ]
27 + [ "pastel" "pastel" [] ]
28 + [ "diskonaut" "diskonaut" [] ]
29 + [ "menyoki" "menyoki" [] ]
30 + [ "zoxide" "zoxide" [] ]
31 + [ "grex" "grex" [] ]
32 + [ "xh" "xh" [] ]
33 + [ "comrak" "comrak" [] ]
34 + # [ "bandwhich" "bandwhich" [] ] masked until https://github.com/imsnif/bandwhich/issues/233
35 + [ "lychee" "lychee" [] ]
36 + [ "viu" "viu" [] ]
37 + [ "licensor" "licensor" [] ]
38 + [ "gib" "gib" [] ]
39 + [ "silicon" "silicon" [] ]
40 + [ "bottom" "btm" [] ]
41 + [ "sic" "sic" [] ]
42 + [ "just" "just" [] ]
43 + [ "mdsh" "mdsh" [] ]
44 + [ "git-delta" "delta" [] ]
45 + [ "selene" "selene" [ "--no-default-features" ] ]
46 + [ "stylua" "stylua" [ "--features" "lua52" ] ]
47 + [ "taplo-cli" "taplo" [] ]
48 + [ "coreutils" "coreutils" (coreutils-features) ]
51 +def coreutils-features [] {
52 + if $env.WIN32? {
53 + [ "--features" "windows" ]
54 + } else {
55 + [ "--features" "unix" ]
56 + }
50 59 def so-features [] {
51 60 if $env.WIN32? {
52 - ["--no-default-features" "--features=windows"]
61 + [ "--no-default-features" "--features" "windows" ]
53 62 } else {

tools/parsing-equals-test.nu

Added
new file mode 100644
1 +def main [] {
2 + assert-is-a { "" } string
3 + assert-is-a { "=" } string
4 + assert-is-a { "-" } string
5 + assert-is-a { "-=" } string
6 + assert-is-a { "-=-" } string
7 + assert-is-a { "=-" } string
9 + assert-is-a { [""] } list<string>
10 + assert-is-a { ["="] } list<string>
11 + assert-is-a { ["-"] } list<string>
12 + assert-is-a { ["-="] } list<string>
14 + # error: unknown command
15 + #assert-is-a { ["-=-"] } list<string>
16 + #assert-is-a { ["=-"] } list<string>
17 + #assert-is-a { ["=-"] } list<string>
19 + assert-is-a { ["= "] } list<string>
20 + assert-is-a { [ "="] } list<string>
21 + assert-is-a { ["=" ] } list<string>
22 + assert-is-a { [ "=" ] } list<string>
24 + assert-is-a { [ "=OK" ] } list<string>
27 +def assert-is-a [
28 + code: block # some nu expression
29 + expected_type: string # expected nu type of given expression, as printed by `describe`
30 +] {
31 + let span = (metadata $code).span;
32 + let actual_type = ( do $code | describe )
33 + if $actual_type == $expected_type {
34 + echo $"(char sun)\t(ansi green_bold)OK(ansi reset)\t($actual_type)"
35 + } else {
36 + error make {
37 + msg: $"(char cloud)\t(ansi red_bold)FAIL(ansi reset)",
38 + label: {
39 + text: $"expected a `($expected_type)` but got a `($actual_type)`",
40 + start: $span.start,
41 + end: $span.end
42 + }
43 + }
44 + }