1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-07-30 21:57:44 +00:00
Commit graph

229 commits

Author SHA1 Message Date
Techno Tecna
f0cd46cafc
Fix custom completion for pass by converting the path pattern string to glob (#1141)
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>
2025-07-03 03:51:53 -05:00
René Stalder
b7120045bc
fix: replace filter with where in composer completions (#1140)
refs https://github.com/nushell/nu_scripts/issues/1134
2025-07-01 06:19:26 -05:00
gin-lsl
156a0110c7
fix(npm): update incompatible npm scripts (#1137)
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:

![image](https://github.com/user-attachments/assets/272a6a37-c623-452a-94ab-2f3c0ee54beb)

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

![image](https://github.com/user-attachments/assets/fcf8b590-0ede-4571-bd52-611cf4c9fdd3)


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.
2025-06-24 17:09:03 -05:00
Darren Schroeder
32cdc96414
replace filter with where (#1135)
This PR tries to clean up the use of `filter` by replacing it with
`where`. I did not test each script.

closes #1134
closes #1133
2025-06-12 06:42:16 -05:00
Cattle_Horse
4f7d9a626a
feat(git): Added complementary support for the git config subcommands (#1117) 2025-05-10 07:37:51 -05:00
Nguyễn Hồng Quân
54f10ee7ee
Fix when lftp bookmark file is not readable (#1114)
Sorry, in the #1113 , I forgot to test the case that `lftp`'s bookmark
file is not readable.
2025-05-03 18:25:23 -05:00
Nguyễn Hồng Quân
e82487722b
Add completions for lftp (#1113)
[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.


![image](https://github.com/user-attachments/assets/4c6c5876-069b-454c-9e49-5e43c9061a52)
2025-05-03 16:14:52 -05:00
Nguyễn Hồng Quân
c0e88c5756
Eliminate duplication in uv completion script (#1112)
This script was generated by uv itself (then add more modification to
provide group completion), but has too many duplication. This PR is to
fix that.
2025-05-03 08:38:00 -05:00
Francesc Elies
5e732dadb0
fix(gh): list my stars wrong sorting (52 seconds ago) <Francesc Elies> (#1110)
github stars listing was wrong because humanized date strings were being
sorted instead datetime objects.

Ref.
https://github.com/nushell/nu_scripts/pull/1109#discussion_r2070528888
2025-05-01 15:22:10 -05:00
Francesc Elies
9ec598c72a
feat(gh): list my stars (#1109)
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
```
2025-05-01 11:52:42 -05:00
Francesc Elies
82aacd5d54
windows nushell stuff (#1105)
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.
2025-04-29 08:56:26 -05:00
Francesc Elies
b442c96ec2
feat(gh-completions): view inlined-comments (#1106)
Adds a command to see comments in github pullrequest.

You can test it as follows

![image](https://github.com/user-attachments/assets/ab76dad8-81f3-432e-9aca-c27227928f96)

One problem I would like to solve is when comments are a very long
single line, in that case the colum becomes very wide, using `explore` I
have the sample problem. Is there an easy way to make text wrap inside a
cell if text longer than a certain threshold e.g. 100 chars?

![image](https://github.com/user-attachments/assets/06dbd03c-e508-48bb-88c3-61809370f5a5)
2025-04-28 06:48:55 -05:00
Jan Klass
488b9b0bc3
Update some fish-sourced generated completion files (#1103)
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
2025-04-22 13:51:22 -05:00
Jan Klass
ddaa6f5bf1
Update some fish-sourced generated completion files (#1102)
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
2025-04-22 13:50:27 -05:00
Jan Klass
43ac47a06b
Drop generated highlight.nu which has no source anymore (#1101)
`highlight.fish` has been removed upstream in
2cb60bed1000a781bf427b56108bba2e7c68ba32

> Remove share/completions/highlight.fish
>
> Highlight ships its own completion script:
>
https://gitlab.com/saalen/highlight/-/blob/master/sh-completion/highlight.fish


2cb60bed10
2025-04-22 13:49:50 -05:00
Jan Klass
448b0177c3
Add md-to-clip custom completions (#1089)
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
```
2025-04-22 12:58:22 -05:00
Jan Klass
123cc5f505
Fix winget show completions (#1091)
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.
2025-04-21 06:16:55 -05:00
Jan Klass
d48b4a0b2b
Remove duplicate "moved" auto-generate files from old location (#1092)
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.
2025-04-20 10:02:18 -05:00
Jan Klass
959c42978b
Fix winget-completions breaking winget show (#1090)
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.yaml

Resolves #825

BREAKING: Drops structured output from `winget show`
2025-04-20 10:01:42 -05:00
Jan Klass
1930c7b47f
Drop draft note (#1088)
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.
2025-04-19 08:42:48 -05:00
Jan Klass
3ad271f838
Improve git completions (#1087)
* 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: 

![](https://github.com/user-attachments/assets/f4030039-87f3-46fd-841c-b961edf4c37a)

Should resolve #1041

Screenshot from before, showing a wrong classification of a local branch
as remote branch:


![](https://github.com/user-attachments/assets/7cbb9545-fe24-48eb-9772-1bba775fcf29)
2025-04-19 06:52:43 -05:00
Cattle_Horse
4d0f184096
feat: Provide completion for docker subcommands (#1085)
This is to provide completion for when user types `docker [Tab]`.
2025-04-18 10:43:19 -05:00
Mussar
b7869a8f33
Add AeroSpace completions (#1080)
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>
2025-04-07 09:57:43 -05:00
Nguyễn Hồng Quân
548b6bbe95
Complete package name for "uv remove" (#1072)
![image](https://github.com/user-attachments/assets/7653d26b-665f-4caa-a764-0f83b41f5519)

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.
2025-04-07 07:23:53 -05:00
Douglas
a19339cdaa
Move custom-completion auto-generate scripts to needs-update (#1076)
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.
2025-03-29 09:57:46 -04:00
Róbert Kalmár
095fa411c7
Fix zellij layouts completions on MacOS (#1074)
According to the
[documentation](https://zellij.dev/documentation/configuration.html#where-does-zellij-look-for-the-config-file)
`~/.config/zellij` will take precedence even on MacOS.
2025-03-19 06:55:35 -05:00
Yethal
0bdf55f71f
Add custom completions for aws-cli (#1073)
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
2025-03-18 14:26:19 -05:00
Nguyễn Hồng Quân
861a99779d
Add completion for uv Python package manager (#1071)
![image](https://github.com/user-attachments/assets/d32230c2-31af-4193-ae4d-17084d1e45c5)


![image](https://github.com/user-attachments/assets/10cc7623-ba3a-447a-81fa-1d7dd09093c3)
2025-03-13 06:14:11 -05:00
Ruan Comelli
61bb4f6b50
Fix heading in zoxide completions README (#1069)
This PR corrects the heading in `custom-completions/zoxide/README.md`,
changing it from "pytest completions" to "zoxide completions" to match
the intended content.
2025-03-11 13:41:52 -05:00
Ruan Comelli
33018df9f9
Fix typo in README file name for pytest's custom completions (#1068)
This PR fixes a typo in the README file name for pytest's custom
completions by renaming `RAEDME.md` to `README.md`. No other changes
were made.
2025-03-11 13:41:15 -05:00
Dan Michael O. Heggø
33a6ba406e
Fix typo: RAEDME.md -> README.md (#1066)
Fixes a small typo
2025-03-08 16:38:44 -06:00
Dan Michael O. Heggø
e732b79ce2
Fix ssh-completions when there's no includes (#1065)
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 :)
2025-03-08 16:38:17 -06:00
Loïc Riegel
c517cd0075
add zoxide custom completions (#1063)
Hello, here are custom completions for zioxide, a tool which I really
like
2025-03-04 19:21:26 -06:00
ziboh
698e240647
style(scoop-completions): Format scoop-completions scripts with topiary-nushell (#1061) 2025-02-28 06:48:52 -06:00
shemraz
3dc7970478
Add komorebi completions (#1055)
This is my first ever PR, hope I've done this right 😅
2025-02-26 08:45:41 -06:00
ziboh
8b40551de7
fix(scoop-completions): correct substring indices to properly trim .ps1 extension (#1056)
here will be an additional dot following each subcommand.

![image](https://github.com/user-attachments/assets/af72e9fa-b92e-4387-b0d8-ba4e84c5f2cf)
2025-02-24 11:43:49 -06:00
Nguyễn Hồng Quân
1da73cf106
Add compatibility note about Nu version (#1057)
This is my response for #1051 

The syntax of this note is inspired by Rust _Cargo.toml_ and Python
_pyproject.toml_.
2025-02-24 06:27:50 -06:00
Nguyễn Hồng Quân
1e7fdd4427
Improve completer speed for git checkout (#1054)
Improvement:
- Faster to give result (calling `git` less, telling `git` to return
simpler-to-parse output).
- Context aware. For example:
+ After `git checkout branch-name`, the rest arguments must be file
paths (`git checkout` only accepts one "branch").
  + After `--` are file paths. `git checkout a-branch -- a-file`

The current completer for `git checkout` is slow because:
- Running `git` too many times.
- Parse many results and end up not use.


![image](https://github.com/user-attachments/assets/48b8542b-0080-4962-a660-2a13e9cb76ea)


![image](https://github.com/user-attachments/assets/8e55e3cf-70bc-404a-b303-7a13d811b5fd)
2025-02-22 07:29:04 -06:00
Nguyễn Hồng Quân
446f06f34f
Improve SSH completion speed (#1050)
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.
2025-02-17 05:33:44 -06:00
Nguyễn Hồng Quân
c85083919e
Autocomplete for "git merge". (#1048)
Just support most often-used options and flags, though.


![image](https://github.com/user-attachments/assets/e9d411b7-6665-4796-bd7e-f06a80d06b73)


![image](https://github.com/user-attachments/assets/780482af-0022-4c16-9ffa-bc78a041c2de)
2025-02-16 07:21:30 -06:00
Nguyễn Hồng Quân
07050f877f
Provide completion for git subcommands (#1044)
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
2025-02-13 20:54:25 -06:00
Nguyễn Hồng Quân
a31f8490fb
Add autocomplete for "docker image rm" (#1040) 2025-02-09 06:56:50 -06:00
Andrey Stepanov
10b22626f7
Added custom completions for loco and cargo loco commands (#1029) 2025-01-30 06:29:47 -06:00
Dave
e6da07f512
Add git reset completion (#1027)
Added a git completion for git reset.
2025-01-28 08:53:33 -06:00
Auca Coyan
fff77c7da6
unsort the completions in git checkout (#1022)
### 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)

![image](https://github.com/user-attachments/assets/ad495b29-e418-426f-9bbe-2056f34b819f)

after: (these aren't)

![image](https://github.com/user-attachments/assets/e2b5d647-cccb-4e0b-b1c2-b80781ada3ec)

### 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
```
2025-01-26 21:27:36 -06:00
Auca Coyan
b42f2bd5c1
remove gstat dependency from git-aliases (#1020)
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
2025-01-25 13:23:57 -06:00
Auca Coyan
759218de6f
🐛 fix additional + in git local branches (#1019)
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:


![image](https://github.com/user-attachments/assets/814c728b-82da-4d15-9f22-ff0fd5a92ae1)

I tested on my pc and works allright!
2025-01-25 08:32:26 -06:00
Loïc Riegel
62c3aa7403
Fix: remove duplicate in git-completions.nu (#1016)
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.
2025-01-15 20:58:54 -06:00
Auca Coyan
4fa48b3e60
🐛 fix some parser issues with type signatures (#1001)
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
2024-12-26 09:28:18 -06:00
DualWu
270aa5ce44
Fix delete-session no auto target (#997) 2024-12-17 21:13:47 -06:00