tangled
alpha
login
or
join now
matrixfurry.com
/
modcli
1
fork
atom
Easily turn Nushell modules into cross-shell CLI tools
library
nu
nushell
1
fork
atom
overview
issues
pulls
pipelines
template: only merge usage when necessary
matrixfurry.com
2 weeks ago
85edb760
59c60b06
verified
This commit was signed with the committer's
known signature
.
matrixfurry.com
SSH Key Fingerprint:
SHA256:OIsNRui6AFD5q4jnVzMss74Th6LbifKVEEyE9czRgMw=
+14
-10
1 changed file
expand all
collapse all
unified
split
template.nu
+14
-10
template.nu
reviewed
···
50
50
| each {|function|
51
51
let help = help $module_name $function | lines
52
52
53
53
-
let usage = if $print_usage {
54
54
-
$help
55
55
-
| get (
56
56
-
($help | enumerate | where item == $"(ansi green)Usage(ansi reset):").0.index + 1
57
57
-
)
58
58
-
| str trim
59
59
-
}
60
60
-
61
53
let short_description = $help
62
54
| first
63
55
| if $in == $"(ansi green)Usage(ansi reset):" {
···
66
58
$in
67
59
}
68
60
69
69
-
{
61
61
+
mut table = {
70
62
command: $"(ansi cyan)($function)(ansi reset)"
71
63
description: $"(ansi lp)($short_description)(ansi reset)"
72
72
-
} | merge {$usage}
64
64
+
}
65
65
+
66
66
+
if $print_usage {
67
67
+
let usage = $help
68
68
+
| get (
69
69
+
($help | enumerate | where item == $"(ansi green)Usage(ansi reset):").0.index + 1
70
70
+
)
71
71
+
| str trim
72
72
+
73
73
+
$table = $table | merge {usage: $usage}
74
74
+
}
75
75
+
76
76
+
$table
73
77
}
74
78
| table --index false --theme rounded
75
79
}