Hi!
It's been a long time using nushell completions, It's about time I can
open a PR 😄
I couldn't finish it in one sitting, but I got the know-how, so I won't
be late to complete it. Left a bunch of `TODO`s
More completions coming!
Keep being awesome 🚀
it might be too trivial to manually create a completion. in many
scenarios, completion is a tree-shaped structure - the current candidate
is influenced by the previous candidate.
`completion-generator` generate completion through tree-like structures
````
{a: {b: {c: {d: 1 e: 2}
````
it uses existing positional arguments as a breadcrumbs to select
candidates in tree structures
as an example, `completion-generator flare` to create completion from
online json data
`completion-generator` supports different structural expressions
````
{value: desc}
{value: { next : ...}
[a b c ...]
[{value: a, description: b, next: [...]]
{|path| ...}
````
these different structures allow any kind of nesting
Co-authored-by: nash <nash@iffy.me>
- update `kadm check` and `kadm renew`
- refactor `nu-complete kube pods or deploys` to `nu-complete kube
deploys and pods`
in #680, `nu-complete kube pods` changed to `pods or deploys`, This has
caused some problems:
- double the number of candidates, and candidates with prefix `pods/`
and `deployment.apps/`, looks a little confused
- two requests in one completion, slower
i wrote `nu-complete kube deploys and pods`, it's completed in two
stages
- first it will complete the `deployment` and add a suffix `-` when
token not ends-with `-`
- when `ka` or `kl` accepts an argument with suffix `-`, it'll be
rewritten as `$"deployment/($pod | str substring ..-1)"`
- if token ends-with `-`, it's considered unfinished `pod` and continues
---------
Co-authored-by: nash <nash@iffy.me>
Add a module to manipulate records.
It can be a potential candidate to nu's standard library ?
Take a look at the name of the functions to see if they respect naming
convention (or if you have better ideas of course 😉 )
- imports `*` are unnecessary
- shorter names for easier reference in task scripts
- `cmd` is too common and may cause potential conflicts
Co-authored-by: nash <nash@iffy.me>
The script was running endlessly for me and the notion of crate waves
may be out of date, after removing them and manually aligning the output
with the relevant crate waves things went smooth.
New crate `nu-lsp`
Only treat `nu-cmd-lang` with the `build.rs` for `version` with the
`--no-verify` treatment in the separate wave
Reorder `nu-command` crates as there are dev-dependencies that may be a
problem
should be the last one... 😇
this PR adds `-toc` to the links in the TOC of the release note
template, they need that for the back reference to the TOC itself in the
section titles
was writing https://github.com/nushell/nushell.github.io/pull/1114 and
noticed a very nice bug...
yeah HTML comments in `.md` documents can't be indented otherwise `npm
install` + `npm run dev` can't render the page 👀
this PR adds
```nushell
let last_release_date = ^gh api /repos/nushell/nushell/releases
| from json
| into datetime published_at
| get published_at
| sort
| last
```
to the relaease note template to get the date of the last release and
list the PRs from there to now.
i've started writting the [release note for
0.86.0](https://github.com/nushell/nushell.github.io/pull/1071) and
thought we could enhance the template for the note even further:
- add some TODOs to make sure we don't forget anything
- make the `NOTE` a real note in the first section, it's just for
prettier rendering
- add some template tables in the "hall of fame"
- ❗ add a table of content to allow jumping back and forth
more easily when the note starts to get big
related to
- https://github.com/nushell/nushell.github.io/pull/1114
i had to use `create-pr` to open
https://github.com/nushell/nushell.github.io/pull/1114 and i thought the
script could be improved in a few ways
- the template had a hardcoded `.0` path version in the semver, this PR
removes is so that the CLI argument can be a full semver, e.g. `0.87.0`
- switch from `explore` to `$env.EDITOR` to preview the completed
template: because it's valid markdown, it looks better in an editor
- fetch the website repo with HTTP and push with SSH: this allows to not
enter the password of an SSH key in the clone step
to help writing the release notes, i think being able to list all the
PRs between the last two releases and format them directly to a raw
table is really nice.
this PR
- `export`s the `main` command from `list-merged-prs`
- adds an example to the `template.md` file of the release notes
the example:
```nushell
use ./make_release/release-note/list-merged-prs
list-merged-prs nushell/nushell <last-release-date>
| where author != "app/dependabot"
| sort-by mergedAt
| update url {|it| $"[#($it.number)]\(($it.url)\)" }
| update author { $"[@($in)]\(https://github.com/($in)\)" }
| select author title url
| rename -c {url: pr}
| to md --pretty
```
will dump all the PRs in a `table<author: string, title: string, pr:
string>` in `md` format:
- `author` is a mardown link to the GitHub page of each author
- `title` is the title of the PRs
- `pr` is a markdown link to the GitHub page of each PR
this pipeline will omit the contributions from @app/dependabot.
Get cwd records in two ways:
- grouping and counting `cwd` field in `history` table of
`$nu.history-path`
- separate `cwd_history` table in `~/.cache/nu_cwd_history.sqlite`
Switch through the environment variable `cwd_history_full`, and switch
this variable through `shift_alt_e`
Co-authored-by: nash <nash@iffy.me>
This PR fixes the conflicts between git-completions.nu and
git-aliases.nu.
Prior to this PR you would see problems like this
```nushell
❯ use custom-completions\git\git-completions.nu *
❯ use aliases\git\git-aliases.nu
Error: nu::parser::missing_flag_param
× Missing flag argument.
╭─[D:\nu_scripts\aliases\git\git-aliases.nu:64:1]
64 │ export alias gco = git checkout
65 │ export alias gcor = git checkout --recurse-submodules
· ──────────┬─────────
· ╰── flag missing string argument
66 │ export alias gcount = git shortlog --summary --numbered
╰────
```
This is because, in this example, in git-completions.nu, there is a
custom command named `git checkout` that takes a `--recurse-submodules:
string` parameter, which means it's expecting a string. Removing the `:
string` part fixes the issue and allows the files to be sourced/used as
expected.
This seems more like a hack than a fix. I'm not sure if this behavior is
intended or not, but this PR fixes it anyway.
close#493
related to
- https://github.com/nushell/nupm/pull/33
## description
with https://github.com/nushell/nupm/pull/33, Nupm can now install
separate modules from a single package 🥳
the `nu_scripts` are a package and looks like they contain a few
potential standalone modules:
- the themes
- the hooks
- the custom completions
- ...
this PR is a proposal to move `themes/` to `nu-themes/` and add
`./nu-themes/` as a module to the `nu-scripts` package.
that way when running `nupm install --path .` in the root of the
`nu_scripts`, a `nu-themes` module will be installed in
`$env.NUPM_HOME/modules`.
then one can run
```nushell
use nu-themes/themes/nushell-dark.nu
```
and next get the theme with
```nushell
nushell-dark
```
The documentation states that the flag `-c`/`--column` now takes a
record as argument instead of an array:
https://www.nushell.sh/commands/docs/rename.html#flags.
I have made the change, and you can check in a nu prompt that it works
as intended:
```nu
let input = (^lsof +c 0xFFFF -i -n -P)
let header = ($input | lines
| take 1
| each { str downcase | str replace ' name$' ' name state' })
let body = ($input | lines
| skip 1
| each { str replace '([^)])$' '$1 (NONE)' | str replace ' \((.+)\)$' ' $1' })
[$header] | append $body
| to text
| detect columns
| upsert 'pid' { |r| $r.pid | into int }
| rename --column { name: connection }
```
related to
- https://github.com/nushell/nushell/pull/10567
- https://github.com/nushell/nushell/pull/10668
- https://github.com/nushell/nushell/pull/10568
this PR removes mentions to removed commands from
https://github.com/nushell/nushell/pull/10567,
https://github.com/nushell/nushell/pull/10668 and
https://github.com/nushell/nushell/pull/10568.
the main change has been introduced with
```nushell
sd 'random integer' 'random int' **/*.nu
```
running `rg "$nothing|random integer|to xml .* --pretty"` gives
- before
```
modules/random-list/random-list.nu
85:# Generate a random integer list.
95: random integer $range
modules/fun/wordle.nu
11: let word = ($words | get (random integer 0..($words | length)) | get column1)
benchmarks/random-bytes.nu
5: | each { random integer }
sourced/misc/password_generator/ReadMe.md
84:Obviously you can just use the `random chars` or `random integers` commands but I like to have words I can read in my passwords, and I think those generated by this script have sufficient entropy.
sourced/misc/password_generator/nupass.nu
43: let random_numbers = (1..$words | par-each { |i| (random integer 0..99) } --threads $threads)
71: return (0..($words - 1) | each { |it| (random integer 0..99 | into string) + ($random_words | get $it) } | reduce { |it
, acc| $acc + $it })
92: | get (random integer 1..($numlines))
99: let rint = (random integer 1..4)
119: | get (random integer 0..($symbolcharslen - 1))
```
- after
```
modules/random-list/random-list.nu
85:# Generate a random integer list.
sourced/misc/password_generator/ReadMe.md
84:Obviously you can just use the `random chars` or `random integers` commands but I like to have words I can read in my passwords, and I think those generated by this script have sufficient entropy.
```
This updated `c` command supports:
* Changing to the previous directory with `c -`
* Changing to absolute directories
* Completion of CDPATH entries
* Completion of absolute paths
* Completion of children
When completing CDPATH entries the parent directory is shown to provide
context in case multiple CDPATH entries have the same child directory
names.
Fixes#244
Full line prompt looks like:
```
---<exeStatus>---------- <workingDirectory> ------ <gitRepoStatus> --- <dirs>
>
```
Where `<exeStatus>` shows `<exe-path> <exe-branch>`,
but is empty if:
* nu exe running from a "bin" folder (based on `$nu.current-exe` path)
* nu exe built from a "main" branch (otherwise shows `(version | get
branch)`)
in this PR i propose
- to add a note about the use of a "breaking change" banner when
detailing a breaking change in it's own section
👉 see the [*Pythonesque operators removal* section of
0.85](https://www.nushell.sh/blog/2023-09-19-nushell_0_85_0.html#pythonesque-operators-removal)
- because we have had these sections for a few releases now, add "hall
of fame" and "changed to commands" sections
The module for `fnm` did not set the path for Windows correctly. I fixed
it by searching for the used `Path` variable (or `PATH`) and use that
instead.
Works now better on Windows without breaking other OSes.