Commit Graph

136 Commits

Author SHA1 Message Date
David Danier
e4dbec663b
Support whitespace before target name for make completions (#858)
TL;DR: The "simple" example from
https://www.gnu.org/software/make/manual/html_node/Simple-Makefile.html
is currently not compatible with the custom completion script found in
`custom-completions/make/make-completions.nu`. This PR tries to fix
that.

As I was working on `nur` (https://github.com/ddanier/nur) and the
`nurify` script to convert to `nur` from different task runners
(https://github.com/ddanier/nur/blob/main/scripts/nurify.nu) I wanted to
create a good way to convert from using `make`. So I thought the `make`
completion would for sure implement a good way to get a list of all
possible `make` targets. Hence I started looking at
`custom-completions/make/make-completions.nu`.

Then I searched for a good documentation for how `Makefile`s work, as
the last time I was using this myself is about 5 to 10 years ago. If you
for example look at the documentation on gnu.org you may find examples
of `Makefile`s not working with the current autocompletion. See
https://www.gnu.org/software/make/manual/html_node/Simple-Makefile.html
for example, the "simple" example they provide.

The reason for this not working is that the targets use some whitespace
after the target name. This is somehow allowed and thus valid. See
https://www.gnu.org/software/make/manual/html_node/Rule-Introduction.html
for a quick overview about how the `Makefile`s syntax works. I quickly
checked this to ensure `make` actually parses this correctly, it really
does.

This means that the current `make` completion does miss support for the
"simple" example provided my `make` itself. So I went on to fix this.

My suggested solution is:
* Filter all lines by regex `'^[\w\.-]+\s*:'` to ensure possible targets
  - start with some word (also allowing `.` and `-`)
  - may have some whitespaces after the word
  - has ":" after this
* Split by the ":"
* Use first column
* Trim the remaining target name to remove those nasty whitespaces
* Use result for completion

For me this did fix the issue with the "simple" `Makefile`, allowing me
to put this into my `nurify` script.

Would be nice to get this "backported" to nu scripts as well. Might help
others 😉
2024-05-30 14:37:43 -05:00
OJarrisonn_
f6ec482ea3
feat: git clone completions (#856)
Adds completions for the `git clone` command
2024-05-28 06:35:27 -05:00
OJarrisonn_
edb832840f
feat: add ./gradlew completions (#855)
Adds completions for when using a `./gradlew` script in Gradle projects

The script provides completions both for the script flags and for the
available tasks in the current project
2024-05-28 06:34:50 -05:00
laisnuto
5ce769ca2c
Add git coommit completions (#854)
Improve git commit completions for nushell
2024-05-28 06:33:48 -05:00
OJarrisonn_
407a313bbb
feat: add bend completions (#842)
Adds [Bend](https://github.com/HigherOrderCO/Bend) completions for
nushell
2024-05-22 12:41:01 -05:00
Tai Zeming
bb1fa35baa
feat(yarn): complete runnables(bin & scripts) (#841)
Allow custom-completions/yarn to complete scripts and bins by explicitly
listing existing commands and scripts & bins that loads from the current
path.
2024-05-22 06:30:50 -05:00
Matt Norton
8a77d51e93
Add more detailed poetry completions (#838) 2024-05-15 08:35:02 -05:00
undefined
f1b0432ad9
feat: add adb&fastboot completions (#834)
Although all correct commands have been added where possible, some
instructions may be missing
2024-05-10 11:05:44 -05:00
Maxim Uvarov
afde2592a6
use typos for corrections (#833)
I used [typos](https://github.com/crate-ci/typos/).
I manually checked all the corrections and they seem safe to me.
There are still some left, but those in this PR are good
2024-05-08 06:47:54 -05:00
zhangym
8c9d0e13bf
feat: add git worktree command (#824) 2024-04-25 07:44:17 -05:00
Konstantins Zmanovskis
912bea4588
Winget custom completions fixes (#823)
Here is a bunch of fixes I implemented to make Winget custom completion
script functional.
Namely,
- Made it compatible with the latest Nushell version
- Fixed parsing of Winget show command
- Added the missing command aliases
- Implemented a workaround for the in Winget itself when filtering for a
particular package source -
https://github.com/microsoft/winget-cli/issues/4236
2024-04-23 06:35:10 -05:00
nils-degroot
b95f260bb4
Add zellij action new-tab completions (#821)
This PR add completions for this `zellij action new-tab` command, which
is currently missing.
2024-04-18 08:28:15 -04:00
zhangym
c33c7808fc
feat: add mvn completion (#819) 2024-04-17 06:38:45 -05:00
Zuruh
f0975a9458
add composer completions (#817)
Implemented definitions for all composer 2.7 base commands with flags,
arguments, and descriptions. Also add completions when a set of values
is expected 🙂
2024-04-12 21:09:00 -05:00
Miles Cranmer
2d3406b526
Fix non-exported completions (#815)
ack, as, and tar were not exported
2024-04-11 18:56:18 -05:00
Christofer
c30efc727b
add missing scoop completions (#812)
I added the missing shims, alias, and help commands for the scoop
completer (#483)

I also updated the deprecated `rootPath` and `globalPath` config names
for the config command
2024-04-07 18:09:04 -05:00
Christofer
dc0aa004c0
add op (1password cli) completions (#807)
1Password cli completions for all of the commands
2024-04-02 12:07:04 -05:00
Auca Coyan
0713693906
add rye completions (#802)
completions to `rye`
2024-03-27 18:36:51 -05:00
Auca Coyan
7d662ad5c5
add gh gist and gh repo list and view (#794)
A bit more of `gh` completions
2024-03-17 07:15:15 -05:00
Auca Coyan
13a73ab635
🐛 fix more parser errors (#783)
Hi! I reduced some of the errors in the daily CI. Still there are a few
of them, but at least is something

- Added the badge for the `daily.yml` (currently failing)
- removed old `docker` from v0.60
- removed old `git` from auto-generate completions
- removed `nethack` from auto-generate completions (wasn't very useful)
- removed `root` from auto-generate completions (wasn't very useful)
- removed `valgrind` from auto-generate completions (wasn't very useful)
- moved `less` from auto-generate to custom-completions.
- moved `mix` from auto-generate to custom-completions.
- moved `tar` from auto-generate to custom-completions.
- moved `tcpdump` from auto-generate to custom-completions.
- moved `virsh` from auto-generate to custom-completions.
- moved `zef` from auto-generate to custom-completions.
- fixed `base16.nu`
- fixed `from-cpuinfo.nu`
- fixed `from-dmicode.nu`
- fixed `to-number-format.nu`
- fixed `to-json-schema.nu`
2024-03-15 21:10:27 -05:00
Auca Coyan
191636af9c
add flutter completions (#792)
Just a barebones `flutter` command and `flutter pub` commands, the most
used ones
2024-03-15 06:30:31 -05:00
Auca Coyan
bc6273d971
🐛 fix a couple of parser errors (#782)
This is some legwork to the CI
- [x] fix one `get-row.nu` before 0.60, just because it was easy
- [x] `modules/formats/to-ini.nu`
- [x] `modules/git/git-v2.nu`
- [x] `modules/git/git.nu`
- [x] `modules/log/log.nu`
- [x] `modules/weather/weatherdark.nu`
- [x] `sourced/api_wrappers/worlframalpha.nu`
- [x] `sourced/cool-oneliners/pwd-short.nu`
- [x] `sourced/github/branch-protections/branch-protections.nu`
- [x] `sourced/gitlab/gitlab.nu`
- [x] `sourced/misc/nu_defs.nu`
- [x] `sourced/update-path.nu`
- [x] `sourced/webscraping/shell_starts.nu`
I moved some auto-generated commands:
- [x] `ack` 
- [x] `as`
- [x] `curl`
- [x] `fsarprc`
- [x] `fsarpri`
- [x] `godoc`
- [x] `mysql` 
- [x] and `xgettext` 
to custom, so we keep the modifications.
I had to comment some of the flags because the parser is not able to
parse some flags. Those are explained in comments
2024-03-10 14:05:01 -05:00
Auca Coyan
5e51b23b1f
🐛 fix scoop completinos (an extra ) (#780)
Just deleting the extra `)`
2024-03-09 13:42:11 +01:00
Shen Zhou
25514da84d
fix: output format changed in zellij ls (#770)
Hi. In the latest zellij (0.39.2), the output of `zellij ls` has been
changed into the following example:
```bash
rectangular-galaxy [Created 9h 21m 46s ago] (EXITED - attach to resurrect)
gregarious-triceratops [Created 22h 48m 32s ago] (EXITED - attach to resurrect)
```
I updated the corresponding parsing code.
2024-03-02 07:42:34 -06:00
Auca Coyan
a60debf624
add cargo-make completions (#769)
Hi! I added cargo make completions 😄 


![image](https://github.com/nushell/nu_scripts/assets/30557287/8d8d64e8-82a7-4d20-8879-f401a00bf6f5)
2024-02-29 14:23:17 -06:00
Auca Coyan
f6bbfe5b77
add rg completions (#767)
I added a lot, but not all the `rg` flags. Currently there are 107 and
most of them aren't "results" related, but compatibility for terminals,
negate previous flags when searching multiple regexes and more.
I selected the most useful flags and write them down in the file.
I accept any suggestion!
2024-02-28 14:14:19 -06:00
Auca Coyan
9fcd386aff
add bat completions (#766)
I use it _all the time_!
I am on my way to `rg` completions too, I use it about as often as `bat`
2024-02-28 09:45:46 -06:00
Auca Coyan
6585a0f515
🐛 fix optional arg in git stash show (#765)
Hi! Another bug I found, in `git`, you can
```bash
git stash show
```
with no args and should be alright, but the .nu script is requiring a
git name. (maybe for a previous version of git it was needed)
2024-02-26 15:42:28 -06:00
Auca Coyan
6309a9f29b
🐛 fix optional args when doing gh repo create and gh repo fork (#763)
Hi!
I found another bug, if you write
```bash
$ gh repo create
```
it leads you to a series of prompts, but the current nu script throws an
error.
I fixed that and `gh repo fork` too, in which you don't necessarily need
an argument.
2024-02-22 13:19:55 -06:00
John Olheiser
36dcb7ccf2
fix: update deprecated spread operator in just (#758) 2024-02-10 16:23:30 -06:00
Martin Wurm
dbf4586594
Extend pass completion (#756)
This PR extends the existing completion for the pass command to include
all existing subcommands (as of pass v1.7.4). It also adds completions
for the pass-otp and pass-update extensions.
2024-02-07 10:46:41 -06:00
Mel Massadian
3f824d3f30
feat: add pixi completions (#755)
Completions for [pixi](https://github.com/prefix-dev/pixi) generated
from the [last commit
(e330e4b831959452b859079f45fdc77e45d741a9)](e330e4b831)
to date using the clap auto generation.
2024-02-07 07:21:36 -06:00
Auca Coyan
73955cd4cf
🐛 fix winget-completions (#749)
Parser did a good job here, explaining
```
Error:   × Deprecated: --flag: bool
    ╭─[C:\...\nu_scripts\custom-completions\winget\winget-completions.nu:27:1]
 27 │
 28 │ def "nu-complete winget flagify" [name: string, value: any, --short(-s): bool] {
    ·                                                                          ──┬─
    ·                                                                            ╰── `--flag: bool` is deprecated and will be removed in 0.90. Please use `--flag` instead, more info: https://www.nushell.sh/book/custom_commands.html
 29 │   let flag_start = if $short { '-' } else { '--' }
    ╰────
```
is not possible anymore, so I removed all the `: bool`s and sourced the
script correctly!
2024-01-25 11:50:26 -06:00
Darren Schroeder
a690fcbaa9
do not require stash in git stash drop (#732)
This fixes a small bug so that `git stash drop` doesn't _require_ a
stash
2024-01-11 07:45:11 -06:00
Simon Jarbrant
b44091aea1
Fix gh status completion (#730)
This is a (probably crude) attempt to address an issue where using the
`gh status` command with gh completions installed would yield the
following error:

```
> gh status
Error: nu::parser::missing_positional

  × Missing required positional argument.
   ╭─[entry #1:1:1]
 1 │ gh status
   ╰────
  help: Usage: gh status {flags} <command> . Use `--help` for more information.
```
2024-01-10 16:13:16 -06:00
Auca Coyan
b9cfa0d204
🐛 fix (default) and (installed) on rustup completions (#721)
Updating rust by
```
rustup update <tab>
```
gives you:


![image](https://github.com/nushell/nu_scripts/assets/30557287/fe65bebc-c593-46b2-b696-bc1d093ee0b6)

and when you press enter on stable:

![image](https://github.com/nushell/nu_scripts/assets/30557287/59b98da7-f174-4518-b30b-88e6a9462603)

the ` (default)` part is piped into the cmdline. This is unintended.
I fixed components, toolchains & targets 💪🏼
2023-12-29 08:35:15 -06:00
Auca Coyan
8386cdc628
🐛 rename yarn for yarn-v4 and add run cmpl (#720)
Heya!

This `yarn` file is aimed at the latest yarn v4, which has different
commands than yarn classic (v1)

I renamed the file to make that difference

```
custom-completions/yarn/yarn-completion.nu
#to
custom-completions/yarn/yarn-v4-completions.nu
```

and also added an improvement on `yarn run` which I have on `pnpm`,
changing this


![image](https://github.com/nushell/nu_scripts/assets/30557287/d7a6a040-95f3-4ab5-8ab8-b59ea4a53433)

into this

![image](https://github.com/nushell/nu_scripts/assets/30557287/95bd2edd-f633-4f37-8f4f-d511f037c270)

(note that the new yarn adds the binaries in addition to the
package.json scripts values)
2023-12-28 10:05:09 -06:00
Auca Coyan
258670c957
code completions (#719)
Hi!
Another command I use frequently. I expected more completions to do, but
turns out `code` is kinda short on flags (compared to `gh` at least)

Some base groundwork is done, it's only missing the `tunnel` and
`serve-web` commands
2023-12-27 08:28:43 -06:00
Auca Coyan
703b551495
add completion to gh pr checkout <tab> (#714)
Hi! I added completion to `gh pr checkout <tab>`
It grabs the first 30 open prs 


![image](https://github.com/nushell/nu_scripts/assets/30557287/755fe63b-dc22-49ef-89c3-27e1ba115d68)

### I tried some things
`gh pr checkout` can accept
- a pr number
- a url
- or a branch

before I tried
- Incrementing the limit of PRs from 30 (default) to 50, but I takes
considerably longer to query, and _gotta go fast_
- using the `extra` field in autocomplete
[`Suggestion`](a4bfaa512b/src/completion/base.rs (L58)).
But I couldn't make it
- tried to use the `title` in the `value`, like this below, but when you
select a row, it pastes the title into the cli, so `gh pr checkout
<title>` doesn't make sense

![image](https://github.com/nushell/nu_scripts/assets/30557287/1c5caf7c-4653-49ba-afc2-ec8ba155b00f)



So, selecting the pr number is the closest I can get to
2023-12-23 00:01:12 -06:00
Auca Coyan
54b5a87f53
add more gh completions (#713)
I added completions for
- [x] `gh repo clone`
    - [x] <tab> gives you a list of your repositories on github
- [x] `gh repo create`
    - [x] `--ignore <tab>` gives you a list of gitignores
- [x] `--license <tab>` gives you a list of licenses with their
description
    
- [x] `gh repo fork` flags

Compared to previous PRs on `gh` completion, it's not much, but these
features are those I use most of the time.
If you want to have completions of some particular subcommand, feel free
to ask!

## Samples

![image](https://github.com/nushell/nu_scripts/assets/30557287/96ddb487-f65b-4f6d-9aed-4ef3be140db7)


![image](https://github.com/nushell/nu_scripts/assets/30557287/3f3ccd5d-1b24-4b05-94e3-c980a0badbf5)
2023-12-22 11:12:10 -06:00
Auca Coyan
3db16cb45f
Add the first layer of depth to the cmds (#708)
Hi! I added a second depth to the commands, (I'm going in
breadth-first).

Also, I added the autocomplete of _your_ repos and orgs when you press

```
gh repo clone <tab>
```

Here is a sample

![image](https://github.com/nushell/nu_scripts/assets/30557287/d7859169-cdb2-4c1b-9681-757698e0641d)
2023-12-21 07:38:02 -06:00
Auca Coyan
d88e68531d
First gh completions (#706)
Hi!
I could squeze some time to do the first `gh` completions.

On the future I will add the subcommands 👍🏼 

docs on 
https://cli.github.com/manual/
2023-12-20 14:56:41 -06:00
Auca Coyan
af92dca520
🐛 Fix rustup use completions and modify README (#696)
Hey, it's me, I finally fixed this `use` vs `source` script.nu 😄 

Also, I added a few lines of the `custom-completions/README.md` to
explain what happened in my case
2023-12-13 16:43:19 -06:00
Auca Coyan
a4cceb8a0b
Add pnpm completions (#692)
Hi!
I added `pnpm` completions. There are a lot of commands, but I added the
most used ones (at least from me)

see you around!
2023-12-09 10:55:52 -06:00
Auca Coyan
cd92a0f405
Add rustup completions (#690)
I did some more work and deleted the old auto-generated `rustup`
2023-12-08 12:28:42 -06:00
Auca Coyan
b30d434ca6
Add rustup completions (#689)
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 🚀
2023-12-08 11:06:47 -06:00
Faïz Hernawan
8635a78991
completions/git: fix support for path relative to current directory (#666)
Continuing effort on https://github.com/nushell/nu_scripts/pull/617
which only auto-completes path relative to git root.

Before,

```
$ cd src/

$ git add <tab>
src/main.rs    Modified
README.md      Untracked

$ git diff <tab>
src/main.rs
```

Now it displays,
```
$ cd src/

$ git add <tab>
main.rs           Modified
../README.md      Untracked

$ git diff <tab>
main.rs
```
2023-11-14 06:25:00 -06:00
fj0r
e4ae994200
cwdhist: alternative to zoxide (#656)
- cwdhist: alternative to zoxide
   - just-completions: remove `--unstable`
   - kubernetes: fix desc of kdh

---------

Co-authored-by: nash <nash@iffy.me>
2023-11-05 06:55:02 -06:00
Darren Schroeder
310b1df564
fix conflicts between git-completions.nu and git-aliases.nu (#651)
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
2023-10-26 15:11:47 -05:00
Alexandre Nédélec
35669a39a9
Move def before extern in winget-completions.nu (#638) 2023-10-15 17:03:53 -05:00