Skip to content

Commit 64a9e01

Browse files
authored
In match expressions, wrap string patterns in quotes. (#1172)
Never hurts to be more explicit.
1 parent ae02260 commit 64a9e01

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

custom-completions/op/op-completions.nu

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,11 +1979,11 @@ def "nu completion duration" [ctx: string] {
19791979
if ($duration | parse --regex ".*?(\\d+)$" | is-not-empty) {
19801980
[s m h d w] | each {|e|
19811981
let label = match $e {
1982-
s => "seconds"
1983-
m => "minutes"
1984-
h => "hours"
1985-
d => "days"
1986-
w => "weeks"
1982+
"s" => "seconds"
1983+
"m" => "minutes"
1984+
"h" => "hours"
1985+
"d" => "days"
1986+
"w" => "weeks"
19871987
}
19881988
{value: $"($duration)($e)", description: $"+($duration | parse --regex '.*?(?<value>\d+)$' | last | get value | into float) ($label)"}
19891989
}

modules/completion-generator/completion-generator.nu

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ export def 'from tree' [
1616
$acc
1717
} else {
1818
match ($acc.schema | describe -d | get type) {
19-
record => {
19+
"record" => {
2020
if $x in $acc.schema {
2121
$acc | merge { schema: ($acc.schema | get $x) }
2222
} else {
2323
$acc
2424
}
2525
}
26-
list => {
26+
"list" => {
2727
let fst = $acc.schema.0? | describe -d | get type
2828
if not ($fst in ['list', 'record']) {
2929
$acc
@@ -50,7 +50,7 @@ export def 'from tree' [
5050
}
5151
}
5252
match ($menu.schema | describe -d | get type) {
53-
record => {
53+
"record" => {
5454
$menu.schema
5555
| transpose k v
5656
| each {|i|
@@ -61,7 +61,7 @@ export def 'from tree' [
6161
}
6262
}
6363
}
64-
list => {
64+
"list" => {
6565
if ($menu.schema.0? | describe -d | get type) == 'record' {
6666
$menu.schema
6767
| each {|x| {$selector.value: null, $selector.description: null} | merge $x }

toolkit.nu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ export def "lint check" []: path -> int {
7272
const current_path = (path self)
7373

7474
let diagnostics = match $test_methodology {
75-
ide-check => {
75+
"ide-check" => {
7676
nu --ide-check 10 $file
7777
| $"[($in)]"
7878
| from nuon
7979
| where type == diagnostic
8080
| select severity message
8181
}
8282

83-
import-or-source => {
83+
"import-or-source" => {
8484
# If any line in the file starts with `export`, then
8585
# we assume it is a module. Otherwise, treat it as source
8686
let has_exports = (open $file | $in like '(?m)^export\s')

0 commit comments

Comments
 (0)