1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-07-30 13:47:46 +00:00
Commit graph

1194 commits

Author SHA1 Message Date
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
Xavier Ruiz
e245718d30
fix "from env" newline handling (#1021)
Many (at least the ones I have encountered) env loaders replace "\n"
with a
literal newline character when loading an env variable. I need this
change in
my personal config and I think others would also prefer this default.
2025-01-25 18:19: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
Stefan Holderbach
fd686c0b0c
Rename range to slice (#1014)
Followup for https://github.com/nushell/nushell/pull/14825
2025-01-17 06:26:29 -06:00
Mel Massadian
1f6ee6c86d
chore: 🧹 update imgcat and add support for kitty (#1017)
This could be done better by exposing more options from the protocol,
but it should be a good start!
2025-01-16 13:00:54 -06:00
Stefan Holderbach
14e3ecb139
Update release excerpt script (#1015)
We moved to a 6 weeks cycle

Also some unnecessary stuff in the API call
2025-01-16 14:51:14 +01: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
132ikl
a9b829115f
Fix path with-parent example output (#1013)
Fix/follow-up to #1011
2025-01-06 13:25:00 -06:00
Edward DeVries
977ffa6c02
panache-git: exclude prompt indicator so user can choose their own (#1012)
Previously, panache-git included a prompt indicator (`> `) out of the
box, and the advice for the user was to remove Nushell's own
configurable prompt indicator by setting it to the empty string.

However, this conflicted with some of Nushell's intended functionality,
such as the ability to use a different prompt indicator in each vi mode.

With this change, panache-git does not include a prompt indicator. The
advice is for the user to use the prompt indicator they like, but to
reset the color so it better matches panache-git's colors.

This is something of a breaking change, in that users who update to the
latest panache-git.nu without making corresponding changes to their
Nushell config might see two prompt indicators (`> > `), but my hope is
that giving users (especially vi mode users) more flexibility with their
prompt indicators will be worth any temporary confusion.
2025-01-06 10:04:22 -06:00
132ikl
059d74ecd5
Rename path replace-extension to path with-extension, add with-stem and with-parent (#1011)
Extends #1002. Renames `path replace-extension` to `path
with-extension`, in following with other languages
([Rust](https://doc.rust-lang.org/std/path/struct.Path.html#method.with_extension),
[Python](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.with_suffix)),
and adds `path with-stem` and `path with-parent`. Also moves the `path`
module into `std-rfc` so it can be used like `use std-rfc/path`.

Adds a private helper function, `with-field`, that `with-extension`,
`with-stem`, and `with-parent` can use. These can each be dead simple
functions, while giving users more options for path manipulation.

The motivation for separate `with-extension`, `with-stem`, and
`with-parent` functions, rather than a more general function like `path
with` is the following:
- `with-extension` has special behavior for stripping periods
- you can tab-complete `path with<TAB>` to immediately see all the
possible options
- you can't accidentally pass an invalid field to `path with` 
- there can be separate examples for `with-extension`, `with-stem`,
`with-parent` for only the relevant functionality
2025-01-06 17:10:51 +08:00
Bahex
66c9995020
add clip copy and clip paste (#1009)
# Description
Add `clip copy` and `clip paste` for interacting with system clipboard,
making use of OSC 52.

I'm not sure how to write tests for these commands.

> [!TIP]
> No platform specific external binary is required.

> [!WARNING]
> - Not all terminal emulators will support this
> - Terminal multiplexers may interfere with it, depending on their
configuration.

# Related
- https://github.com/nushell/nushell/pull/11131
- https://github.com/nushell/nu_scripts/pull/674
2025-01-05 06:52:46 -06:00
Wind
2dadab779b
add path replace-extension to stdlib-candidate (#1002)
Adds `path replace-extension` as requested in https://github.com/nushell/nushell/issues/14144

Also sets up testing for candidates. In order to do this, I made
some changes:

1. ported `nu-std/testing.nu` under `stdlib-candidate` folder, and
making some changes.
2. run candidate tests in `toolkit check pr` command, to make sure the
test is run in CI.
3. including `stdlib-candidate` to `NU_LIB_DIRS` when running lint, so
the tests can pass linter.

Changes in stdlib-candidate/testing.nu:

1. remove `std/log` usage
2. including `stdlib-candidate` path in `run-test` command
2025-01-03 23:57:13 -05:00
Douglas
66e4845b60
Remove some outdated comments (#1008)
Nitpick, but I've noticed it a few times so figured I'd just go ahead
and get rid of it.

* Mainly, removed the comment about changing the hardcoded 30-width
terminal since it's now handled dynamically (at least in this module)
* Also removed references to engine-q

I notice there are a lot of other engine-q references when I grep
`nu_scripts`, but I'll leave those for another day. Some of those are
probably pretty outdated (e.g., `init.nu` in the example config) and
need to be culled.
2025-01-02 09:50:14 -06:00
Zh_Jk
d316685063
Update rbenv module (#1007)
heres the changes

- Removed outdated code
- Replaced the old load-env with $env assignment
- Kept the rbenv command intact but focused on the "rbenv shell"
(modified a subcommand rather than the whole command)
- Deleted unused command completions
2025-01-01 08:15:40 -06:00
Kuo-tung Kao
de3865188e
support nu 101 for argx module (#1006)
Since 101, `++=` only support concatenation. Fix argx module bug.
2025-01-01 07:55:09 -06:00
Bahex
c1bbcafb14
fix(aggregate): propagate errors from aggregate operation closures (#1005) 2024-12-31 13:58:40 -06:00
Bahex
8db6af6376
[stdlib-candidate] add aggregate (#991)
# Description

Add `aggregate`, a command that operates on the output of `group-by
--to-table` to help aggregate to do quick inspections.

# Related
- https://github.com/nushell/nushell/pull/14316#issuecomment-2511395679
- https://github.com/nushell/nushell/issues/2607
- https://github.com/nushell/nushell/pull/14337

# Examples

```nushell
open ~/Downloads/movies.csv
  | group-by Lead_Studio Genre --to-table
  | aggregate Worldwide_Gross
  # | first 4
  # | to md
```


|Lead_Studio|Genre|count|Worldwide_Gross_min|Worldwide_Gross_avg|Worldwide_Gross_max|Worldwide_Gross_sum|
|-|-|-|-|-|-|-|
|The Weinstein Company|Comedy|1|19.62|19.62|19.62|19.62|
|The Weinstein Company|Drama|1|8.26|8.26|8.26|8.26|
|Independent|Comedy|7|14.31|57.01|205.3|399.07|
|Independent|Romance|7|0.03|149.82142857142858|702.17|1048.75|

---

```nushell
open ~/Downloads/movies.csv
  | group-by Lead_Studio Genre --to-table
  | aggregate Worldwide_Gross --ops {avg: {math avg}, std: {math stddev}}
  # | first 4
  # | to md
```

|Lead_Studio|Genre|count|Worldwide_Gross_avg|Worldwide_Gross_std|
|-|-|-|-|-|
|The Weinstein Company|Comedy|1|19.62|0|
|The Weinstein Company|Drama|1|8.26|0|
|Independent|Comedy|7|57.01|66.1709932134704|
|Independent|Romance|7|149.82142857142858|229.79475832816996|

---

```nushell
open ~/Downloads/movies.csv
  | group-by Lead_Studio Genre --to-table
  | aggregate Worldwide_Gross Audience_score_% --ops {avg: {math avg}}
  # | first 4
  # | to md
```

|Lead_Studio|Genre|count|Worldwide_Gross_avg|Audience_score_%_avg|
|-|-|-|-|-|
|The Weinstein Company|Comedy|1|19.62|52|
|The Weinstein Company|Drama|1|8.26|84|
|Independent|Comedy|7|57.01|60.142857142857146|
|Independent|Romance|7|149.82142857142858|59.857142857142854|
2024-12-31 13:07:35 -06:00
Darren Schroeder
a83a40dff0
update oh-my.nu to respect use_ansi_coloring config setting (#1003)
A quick update to allow the oh-my.nu prompt to respect the
$env.config.use_ansi_coloring by way of a new command called `config
use-colors`. This way the prompt will be rendered correctly as far as
ansi escapes.

This file was also formatted with `topiary` which makes up for the rest
of the changes.

This will only work on nushell version 0.101.1 and above.
2024-12-27 07:10:35 -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
WindSoilder
43d122448c Revert "add path extension func to stdlib-candidate"
This reverts commit b50215132b.
2024-12-26 21:47:38 +08:00
WindSoilder
b50215132b add path extension func to stdlib-candidate 2024-12-26 21:45:51 +08:00
Stefan Holderbach
89c3d6d92b
Fix table of contents generation for release notes (#1000)
- [x] fixed typo: `table-of-content` in the backreference
- [x] missing sanitization of `_`,`+`,`.`,`?` etc.
- [x] handling the confusion of h1 `#` and comment `#`
2024-12-22 22:48:55 +01:00
Stefan Holderbach
ba13f5ca60
Fix input-output signatures (#999)
Since 0.101.0 we will finally catch more illegal `def` signatures. As
the grammar for input/output types is rather restricted, this would
error otherwise
2024-12-22 07:58:11 -06:00
Wind
be6411ef4a
conda activate should expand $env.PATH to a connection of absolute paths (#998)
Noticed an issue in `conda.nu`.

It modified `$env.PATH` from list of string to a string, without
**expanding** it. It may be a problem if I have a path which is
relative:
```nushell
$env.PATH = ($env.PATH | split row (char esep) | prepend '~/.cargo/bin')
```
After activating an env, it's impossible to find executables in
`~/.cargo/bin`. So this pr is going to make sure the path is expanded
while converting.

For more context:
https://github.com/nushell/nushell/pull/14615?notification_referrer_id=NT_kwDOAVOaGrQxMzkwODcxMjU3NjoyMjI1NjE1NA#issuecomment-2552696978
2024-12-18 21:50:31 -06:00
DualWu
270aa5ce44
Fix delete-session no auto target (#997) 2024-12-17 21:13:47 -06:00
Douglas
73e094fc08
Fix invalid type signature (#996)
Fixes the invalid type signature that is now caught by
https://github.com/nushell/nushell/pull/14510
2024-12-17 16:09:14 -06:00
Douglas
ba447f942c
Add and update new config files (#995)
`bump-version.nu`:

* Adds the new file location for config files
* Adds the new config files
2024-12-17 16:08:53 -06:00
DualWu
5a74077d38
update zellij completions (#994) 2024-12-17 06:34:07 -06:00
Nguyễn Hồng Quân
8c21f6e5a6
Follow Include to extract more SSH hosts (#993)
Sometimes, we have so many SSH servers that divide to extra config files
and include in *~/.ssh/config*

This PR follow the `Include` directive to retrieve more hosts.

Example of such config:

```ssh_config
Include extra/agriconnect
Include "extra/Old servers"
```

This PR also fix an issue that orginal code grabs this:

```ssh_config
Host *
```
2024-12-14 06:49:27 -06:00
Antoine Stevan
cc62dd7f0f
don't return anything from toolkit command (#992)
i get the following LSP error in my editor, because it's true `main`
does not return a `string` 🤔


![image](https://github.com/user-attachments/assets/787f62f8-ef66-4ac4-ba30-c396d3cdd4d2)


in this PR, i propose to truely return `nothing` from this _main_
command by `print`ing the help page.

### alternative
we could also change the signature to `nothing -> string`
2024-12-12 08:05:51 -06:00
ff2400t
b5385a2af0
in commands table rename usage to description (#990)
`usage` column under the `scope commands` table has been renamed to
description since nushell version 0.98.0
2024-12-08 07:27:33 -06:00
Darren Schroeder
09c4ca4ac0
update description to usage in weather module 2024-12-08 07:26:25 -06:00
e2dk4r
ce89b5cf0b
custom-completions: scoop: improve code readablity (#989)
Break getting scoop directories multiple lines to improve code
readablity.
2024-12-07 07:27:01 -06:00
e2dk4r
6bd54bfab2
custom-completions: scoop: improve performance of getting scoop commands (#988)
Instead of calling scoop that calls powershell, use nushell's native
commands.

On Windows 11 virtual machine,
powershell takes `330ms 492µs 860ns` on **fastest** case,
with this commit takes `23ms 24µs 660ns` on **slowest**.

```nu
> use old-scoop-completions.nu *
> let oldTimes = (1..10 | each { timeit { scoopCommands } })
> $oldTimes | sort --reverse
╭───┬───────────────────╮
│ 0 │ 357ms 565µs 720ns │
│ 1 │  344ms 64µs 450ns │
│ 2 │ 343ms 264µs 680ns │
│ 3 │  342ms 686µs 10ns │
│ 4 │ 342ms 241µs 740ns │
│ 5 │ 338ms 365µs 910ns │
│ 6 │ 337ms 682µs 790ns │
│ 7 │ 335ms 473µs 290ns │
│ 8 │ 335ms 186µs 830ns │
│ 9 │ 330ms 492µs 860ns │
╰───┴───────────────────╯
> $oldTimes | math avg
340ms 702µs 428ns

> use scoop-completions.nu *
> let newTimes = (1..10 | each { timeit { scoopCommands } })
> $newTimes | sort --reverse
╭───┬──────────────────╮
│ 0 │  23ms 24µs 660ns │
│ 1 │  18ms 33µs 480ns │
│ 2 │ 15ms 597µs 650ns │
│ 3 │ 15ms 412µs 850ns │
│ 4 │  15ms 58µs 770ns │
│ 5 │  14ms 536µs 30ns │
│ 6 │  14ms 366µs 20ns │
│ 7 │ 14ms 175µs 270ns │
│ 8 │ 13ms 688µs 730ns │
│ 9 │ 13ms 378µs 590ns │
╰───┴──────────────────╯
> $newTimes | math avg
15ms 727µs 205ns
```
2024-12-07 07:13:00 -06:00
Douglas
6c9f974df6
Stdlib-candidate Reset (#986)
On today's call, we decided to reset stdlib-candidate and start fresh
(and try to manage it more effectively going forward).

This PR is that reset, along with an updated README for the new module.

The main thing that needs reviewing here is the
[README](https://github.com/nushell/nu_scripts/pull/986/files#diff-680b95f9d9e2e9c06ee31ff6835e5d29ba11703ef7252bd42ecafa433767e0c6).
2024-12-05 11:45:59 -06:00
Jingyu
c2d10f17af
Add readme for kubernetes module (#987)
Add readme content for kubernetes module
2024-12-05 07:51:42 -06:00
Rikuki IX
47846699c7
Add Catppuccin Frappe theme (#984)
One more color palette from catppuccin.

---------

Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
2024-11-27 07:01:09 -06:00
Ian Manske
dee0e7efcd
Fix typos (#982) 2024-11-21 23:51:05 -05:00
Ian Manske
fc1d1989b6
Edit release notes template and edit scripts (#981)
Making the release scripts easier to use as well as automating more of
the process.
2024-11-22 03:12:26 +00:00
Jingchen Wang
1ed7ef9401
basic docker compose support: up down stop (#979) 2024-11-10 07:14:37 -06:00
Blake Miner
e380c8a355
Fixed bug where find_in globs were matching directories (#980) 2024-11-06 16:08:08 -06:00
Elizabeth
58f8c75688
fix: network/sockets command (#978) 2024-10-29 06:31:52 -05:00
Antoine Sébert
96c7e61141
fix: remove now unecessary -b flag (#977)
The `-b`, that outputs the value as binary, has been removed as it is
now the default behaviour.
```sh
"U29tZSBEYXRh" | decode base64                                                                                                                                        2024-10-20 20:56:15 
Length: 9 (0x9) bytes | printable whitespace ascii_other non_ascii
00000000:   53 6f 6d 65  20 44 61 74  61                         Some Data
```
Docs: https://www.nushell.sh/commands/docs/decode_base64.html
2024-10-20 14:29:26 -05:00
shelton louis
fa12d3e905
Fix errors with yadm command file. (#976)
This is to fix mistakes that are in the yadm module. 
This is necessary for my users. I didn't change any of the files here at
all.
2024-10-18 21:42:31 -05:00
shelton louis
04c70789ea
Rewrite the yadm module. (#975)
I'm here to fix the mistake that I made with the Yadm module.

I removed completions in favor of just scripts. 
I also added a way to install yadm as well.
2024-10-17 16:02:10 -05:00
Blake Miner
c67a6959fc
Added find_in command to search files (#972) 2024-10-16 21:27:23 -05:00
Berge della Hirsch
c05790d2fc
Updated ani-cli completions (#969)
Updated, corrected, and added the rest of the completions needed for
`ani-cli`
2024-10-09 18:19:16 -05:00
Douglas
743ccc08ee
Table and list helper commands (#967)
From https://github.com/nushell/nushell/issues/13887, this adds:

```nu
into list
select ranges
select column-ranges
reject ranges
reject column-ranges
row-indices
col-indices
```

Note that these replace the former `get-row` and `get-col` commands that
were in the library. They have the same functionality and can accept any
combination of:

* One or more row or column indices
* One or more row or column ranges
2024-10-03 06:31:49 -05:00
Douglas
e4c5af9a58
Remove outdated logging module (#966)
I haven't been through all of them yet, and some of those that I have
reviewed still have useful info that should be preserved. However, this
`logging.nu` version seems to long predate the one we now have in the
standard-library.
2024-10-02 07:40:54 -05:00