Password file completion for `pass` no longer worked as the pattern was
passed to `ls` as a string.
Fixed it by converting the pattern to a glob.
Co-authored-by: TechnoTecna <techno.tecna@protonmail.com>
I use Nushell and npm, and noticed that the npm section hasn't been
updated for a long time, to the point where it no longer works with
current npm versions. In fact, the current script produces the following
result:

So I've updated the npm-related scripts to fix this issue. Now it works
correctly:

Additionally, since npm -l | lines generates over 900 lines of output,
this causes each run to take a long time (at least on my machine).
Therefore, I've implemented caching using stor to store the results,
which significantly reduces the execution time for subsequent calls.
With caching enabled, the delay is now barely noticeable.
[lftp](https://lftp.yar.ru/) is the program which I use when I need to
copy many files at once via SSH. Though having `FTP` in the name, it
supports more protocols than just FTP.
This PR provides auto-completion for the "site" argument. Source of
sites are:
- SSH aliases (for SFTP and FISH protocols).
- LFTP's bookmarks.

Sometimes you know you starred something long time ago, the you go to
github.com your stars and search on the bar.
That's all good but wouldn't it be great to do that from the comfort of
nushell?
This pr does that.
You can test it with
```nu
gh my stars | explore
```
Sometimes I have to use windows,
I would like to have a place were I can find useful nushell stuff making
my easier and maybe eventually copy stuff other people might contribute.
Would you see this fit?
**NOTE**: I will gladly remove editorconfig if you prefer a separate pr
or you don't want it at all.
Run `build-completions-from-pwd` from fish-shell completions
Through needs-update/custom-completions/auto-generate/parse-fish.nu with
https://github.com/fish-shell/fish-shell
share/completions/
9d904e111345a64eb4ff05ecd8d7737f22cfc762
Selective on which files to take over for reviewability and certain
improvements
Run `build-completions-from-pwd` from fish-shell completions
Through needs-update/custom-completions/auto-generate/parse-fish.nu with
https://github.com/fish-shell/fish-shell
share/completions/
9d904e111345a64eb4ff05ecd8d7737f22cfc762
Selective on which files to take over for reviewability and certain
improvements
Resolves#414
* Syntax source
https://github.com/command-line-interface-pages/v2-tooling/tree/main/md-to-clip
---
I used the descriptions from the Fish completions on the referenced
page/docs.
```nushell
nu ❯ help md-to-clip
Converter from TlDr format to Command Line Interface Pages format.
https://github.com/command-line-interface-pages/v2-tooling/tree/main/md-to-clip
Usage:
> md-to-clip {flags} <file> ...(args)
Flags:
-h, --help: Display help
-v, --version: Display version
-a, --author: Display author
-e, --email: Display author email
--no-file-save: Whether to display conversion result in stdout instead of writing it to a file
--output-directory <path>: Directory where conversion result will be written
--special-placeholder-config <path>: Config with special placeholders
Parameters:
file <path>: Source tldr page to convert
...args <external-argument>: all other arguments to the command
```
Update `winget show` completions according to official docs at
https://learn.microsoft.com/en-us/windows/package-manager/winget/show
Sort flags like official documentation.
Remove multiple flags which seemingly come from `winget install`;
presumably a copy-paste error when originally implementing this command.
PR #1076 titled 'Move custom-completion auto-generate scripts to
needs-update' added the README and target files,
but was missing the removal of the source files (moved files).
The files in `needs-update/custom-completions/auto-generate/` are
identical.
by dropping output parsing of non-stable unstructured output into
structured output.
---
winget-completions.nu defines more than custom completions: it defines
parsing for `winget show`, `winget source list`, `winget search`,
`winget list`.
`winget show` shows different user messages and rendered manifest
information.
#825 reports winget show breakage for `winget show` for packages
`carapace`, `Peppy.Osu!`, `flux.flux`.
The source yaml (for example
[rsteube.Carapace.locale.en-US.yaml][sourceyaml]) is in YAML format. The
command implementation tries to parse the rendered output and transform
it into yaml, but fails to do so. The logic is quite complicated and
error prone, with no guarantees on `winget show` output stability in
text or format.
Rather than trying to this the script, it seems safer to drop parsing
the output into a structure format. #825 indicates winget show has been
broken for a year.
If we want to support structured output from `winget show`, it would be
preferable to depend on `winget show` offering a structured output
option (which it currently does not offer), or at least not offer
error-prone parsing as a default part of *custom completions*. Users can
still parse the output themselves. Independent of this removal, users
may suggest alternative less error-prone or custom-completion-breaking
approaches.
[sourceyaml]:
2ec31577c4/manifests/r/rsteube/Carapace/1.3.0/rsteube.Carapace.locale.en-US.yamlResolves#825
BREAKING: Drops structured output from `winget show`
This comment was a WIP draft note.
The separate `git show` command call is not necessary because
`get-all-git-local-refs` through `for-each-ref` already includes the
commit title. So the comment can be dropped without further
consideration / is already resolved.
* Fix previous logic assuming single remote name `origin`
* Fix wrong Local vs Remote branch name descriptions
* Fix git branch output with multiple branches per line breaking
auto-completions
* Fix current branch not showing up in git checkout branch completions
* Fix remote branches not showing up when local branch with upstream
exists despite them being different refs
* Show more contextual information in completion descriptions
* Use consistent sorting between command completions; Local branches
before remote branches before files before commits, with sorting from
git kept intact
Change implementation to a more encapsulated and type-specific approach:
* Use for-each-ref instead of git branch with manual current branch
query and current and HEAD ref removal
* Separate local and remote branch logic for good case separation
* Use separate for-each-ref calls for early case separation
* Decorate local and remote branch information in their respective cases
instead of content-conditional
* Decorate with 'Branch, Local|Remote, Commit Sha1 Subject, upstream
[head|behind x]
* Use new consistent description format '{Type}' | '{Type}, Commit
{Sha1} Subject | '{Type}, {Subtype}, {Commit Sha1+Subject}, {upstream
name + track}
* Dissolves some spread out logic, dropping commands
get-all-git-branches and extract-remote-branches-nonlocal-short and
extract-mergable-sources
Influenced completions: `git checkout`, `git switch`, `git merge`
---
Screenshot:

Should resolve#1041
Screenshot from before, showing a wrong classification of a local branch
as remote branch:

First attempt at a full custom completion! Got all the base commands set
and documented. Most arguments are fleshed out, but I haven't figured
out a good solution for subcommands that have exclusive arguments, or
how to progressively show subcommands with their own set of externs.
I've put the completed-but-not-implemented work in a separate file, to
be incorporated later as I figure out the process to do so.
---------
Co-authored-by: Joshua Nussbaum <67082011+joshuanussbaum@users.noreply.github.com>

Drawback:
The flags of "uv remove" command are no longer completed after I add
competer like this:
```nu
export extern "uv remove" [
--no-config
--help(-h)
--version(-V)
...packages: string@"nu-complete uv packages"
]
```
I have no solution yet.
A user in Discord recently tried to run the auto-generate script to
create completions from `<command> --help` and had issues. In examining
the scripts, I found that they used `build-string`, which was deprecated
and removed over 2 years ago. In order to prevent future confusion until
(and if) these files are updated, I'm moving them to a `needs-update`
directory in the repo.
Any other outdated files can be moved there as well.
Aws-cli ships with a dedicated completion binary that only needs to be
passed current commandline to work. Space is appended to returned
results so that completing subcommands can be done simply by pressing
tab multiple times
This PR corrects the heading in `custom-completions/zoxide/README.md`,
changing it from "pytest completions" to "zoxide completions" to match
the intended content.
The ssh-completion didn't work when I first tried to source it. Turned
out that `reduce` failed when `$includes` was an empty list:
```nushell
$includes | par-each {|p| $p | open --raw | process } | reduce {|it| merge deep $it --strategy=append }
```
The change proposed in this PR fixes the problem so the completion also
works if there are no includes in the ssh config files. I'm a total
nushell beginner though, so I'm not sure if it's the best or the most
idiomatic way to solve the problem :)
In my machine, the SSH host definitions are spread over many files and
the old implementation is slow to give auto-complete.
This PR is to improve the speed.
This is to provide completion for when user types `git [Tab]`.
There is already completion for `git help [Tab]` but I don't know why
author don't add it to `git` alone.
Fixes#1043
### motivation
Hi! This is something I wanted since [#14424 of
nushell/nushell](https://github.com/nushell/nushell/pull/14424) landed.
Unsorted completions on the `git checkout` command
### The problem
is that git checkout accepts lots of things: commits hashes, filenames,
local branches and remote branches. Since the mentioned pr all the
completions were sorted, but for this command it didn't make sense.
I used `git switch` to checkout a branch for the time being, but it's a
little annoying that you can't push "unsorted" completions on a command.
### the result
With the help of ysthakur and weirdan, I managed to achieve this:
```
git checkout <tab>
```
before: (these are sorted)

after: (these aren't)

### How?
Citing the docs:
https://www.nushell.sh/book/custom_completions.html#options-for-custom-completions
```
{
options: {
case_sensitive: false,
completion_algorithm: prefix,
positional: false,
sort: false,
},
completions: [cat, rat, bat]
}
}
```
and I passed **a table** to the `completions` key, instead of a _list_.
```
completions: $table_of_checkouts
```
I removed `gstat` plugin dependency need by replacing the command.
~~The only problem is that the aliases don't work for the current
nushell version~~
Done!
fixes#973 and closes#974
Hi! I realized if you use worktrees, with at least one branch checked
out and you:
```
git switch <tab>
```
the autocompletion is wrong, putting a `+ ` before the branch, and
piping it into the cmdline.
This comes from `nu-complete git local branches` function, it which it
only replaces `* ` for the current branch, but it doesn't for `+ ` for
worktrees.
Here is a sample:

I tested on my pc and works allright!
This remove a duplicate: the `--no-edit` was there twice in the "git
commit" command completion.
After my change, the only remaining `--no-edit` is at line 455.
When I updated nu to 101, the completions of poetry failed because of a
missing `:`
this
```nu
def "nu-complete poetry python-versions" [] nothing -> list<string> {
```
for this
```nu
def "nu-complete poetry python-versions" []: nothing -> list<string> {
```
Fixed a couple of places and some other parser issues