1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 22:57:46 +00:00

Port before_v0.60/make_release folder (#830)

This PR is part of porting all old scripts #221 and ports `make_release`
folder
## Summary

### make_release/this_week_in_nu_weekly.nu
This script has already been ported and has received some updates: #433.
So I just removed it
```yaml
from: before_v0.60/make_release/this_week_in_nu_weekly.nu
to: make_release/this_week_in_nu_weekly.nu
functions:
    do-work: make_release/this_week_in_nu_weekly.nu:1:query-week-span
```

### make_release/this_week_in_nu_release.nu

I have ported this, but I'm not sure if we need it because it has
strange name and we have `prs.nu` and `make_release/release-note/`

```yaml
from: before_v0.60/make_release/this_week_in_nu_release.nu
to: make_release/this_week_in_nu_release.nu
functions:
    do-work: make_release/this_week_in_nu_release.nu:1:do-work
```

### make_release/nu_release.nu

This has already been ported to `make_release/nu_release.nu` and has
received new updates #828 so I just removed it

```yaml
from: before_v0.60/make_release/nu_release.nu
to: make_release/nu_release.nu
```

### make_release/gen-js-ext.nu
This has already been moved to `make_release/gen-js-ext.nu` and has
received new updates #621 but not completely ported so I have ported it
- pipeline `for` to `each`
- `$nu.scope.commands` to `scope commands`
- explicit `print`
```yaml
from: before_v0.60/make_release/gen-js-ext.nu
to: make_release/gen-js-ext.nu
functions:
  gen_keywords: make_release/gen-js-ext.nu:1:gen_keywords
  gen_sub_keywords: make_release/gen-js-ext.nu:20:gen_sub_keywords
```

### make_release/gen-ts-ext.nu
I have ported this script
```yaml
from: before_v0.60/make_release/gen-ts-ext.nu
to: make_release/gen-ts-ext.nu
functions:
  gen-ts-cmds-begin: make_release/gen-ts-ext.nu:1:gen-ts-cmds-begin
  gen-ts-cmds: make_release/gen-ts-ext.nu:18:gen-ts-cmds
  gen-ts-subs: make_release/gen-ts-ext.nu:40:gen-ts-subs
```
This commit is contained in:
Igor 2024-05-13 17:53:13 +04:00 committed by GitHub
parent 2fe0756df9
commit 13f2c47135
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 186 additions and 303 deletions

View file

@ -1,10 +1,10 @@
def gen_keywords [] {
let cmds = ($nu.scope.commands
let cmds = (scope commands
| where is_extern == false
and is_custom == false
and category !~ deprecated
and ($it.command | str contains -n ' ')
| get command
and ($it.name | str contains -n ' ')
| get name
| str join '|')
let var_with_dash_or_under_regex = '(([a-zA-Z]+[\\-_]){1,}[a-zA-Z]+\\s)'
@ -12,46 +12,46 @@ def gen_keywords [] {
let postamble = ')\\b'
$'"match": "($var_with_dash_or_under_regex)|($preamble)($cmds)($postamble)",'
}
$"Generating keywords(char nl)"
gen_keywords
char nl
char nl
print $"Generating keywords(char nl)"
print (gen_keywords)
print (char nl)
print (char nl)
def gen_sub_keywords [] {
let sub_cmds = ($nu.scope.commands
let sub_cmds = (scope commands
| where is_extern == false
and is_custom == false
and category !~ deprecated
and ($it.command | str contains ' ')
| get command)
and ($it.name | str contains ' ')
| get name)
let preamble = '\\b('
let postamble = ')\\b'
let cmds = (for x in $sub_cmds {
let cmds = ($sub_cmds | each {|x|
let parts = ($x | split row ' ')
$'($parts.0)\\s($parts.1)'
} | str join '|')
$'"match": "($preamble)($cmds)($postamble)",'
}
$"Generating sub keywords(char nl)"
gen_sub_keywords
char nl
print $"Generating sub keywords(char nl)"
print (gen_sub_keywords)
print (char nl)
def gen_keywords_alphabetically [] {
let alphabet = [a b c d e f g h i j k l m n o p q r s t u v w x y z]
let cmds = ($nu.scope.commands
let cmds = (scope commands
| where is_extern == false
and is_custom == false
and category !~ deprecated
and ($it.command | str contains -n ' ')
| get command)
and ($it.name | str contains -n ' ')
| get name)
let preamble = '\\b('
let postamble = ')\\b'
for alpha in $alphabet {
let letter_cmds = (for cmd in $cmds {
$alphabet | each {|alpha|
let letter_cmds = ($cmds | each {|cmd|
if ($cmd | str starts-with $alpha) {
$cmd
} else {
@ -64,25 +64,25 @@ def gen_keywords_alphabetically [] {
} | str join "\n"
}
"Generating keywords alphabetically\n"
gen_keywords_alphabetically
char nl
print "Generating keywords alphabetically\n"
print (gen_keywords_alphabetically)
print (char nl)
def gen_sub_keywords_alphabetically [] {
let alphabet = [a b c d e f g h i j k l m n o p q r s t u v w x y z]
let sub_cmds = ($nu.scope.commands
let sub_cmds = (scope commands |
| where is_extern == false
and is_custom == false
and category !~ deprecated
and ($it.command | str contains ' ')
| get command)
and ($it.name | str contains ' ')
| get name)
let preamble = '\\b('
let postamble = ')\\b'
for alpha in $alphabet {
let letter_cmds = (for cmd in $sub_cmds {
$alphabet | each {|alpha|
let letter_cmds = ($sub_cmds | each {|cmd|
if ($cmd | str starts-with $alpha) {
let parts = ($cmd | split row ' ')
$'($parts.0)\\s($parts.1)'
@ -96,6 +96,6 @@ def gen_sub_keywords_alphabetically [] {
} | str join "\n"
}
"Generating sub keywords alphabetically\n"
gen_sub_keywords_alphabetically
char nl
print "Generating sub keywords alphabetically\n"
print (gen_sub_keywords_alphabetically)
print (char nl)