Commit Graph

814 Commits

Author SHA1 Message Date
Stijn van Houwelingen
9fc4eb0ac5
Added updated and improved version of the conda scripts (#694)
I have been using the script myself for a while, so I am fairly
confident that it works. I would prefer if I could make mamba activate
work out of the box but putting aliases in the file doesn't seem to
work, so If anyone knows how to make that work, that would be great.
2023-12-12 12:56:38 -06:00
Antoine Stevan
1e28cc1560
add a "bulk rename" command to the stdlib candidates (#643)
i received an archive with files with integer ids in their names (1, 2,
...) but because these ids had no padding, the files were completely out
of order when sorting... e.g. 9 comes after 10 because 1 comes before 9
as a character 🤔

i wrote a command to rename a bulk of files in a directory with a
closure 😋

i was not really sure where to put it, so i created
`stdlib-candidate/fs.nu` 👍
2023-12-11 09:00:10 +01:00
Eric Hodel
db9606af6c
Improve git branch cleanup script (#685)
This implementation prunes local branches that have been merged and
optionally prunes remote branches that have been merged.

The script may be configured to keep branches through local git
configuration.

The remote name can be autocompleted.
2023-12-10 09:05:57 -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
Max Brown
060903128d
Adding the A case (#688)
I'm handling the add 'A' case here, otherwise we get a null and the
pipeline breaks.
2023-12-07 11:09:56 -06:00
Antoine Stevan
725b92b254
add missing tasks to the release note PR (#665)
see https://github.com/nushell/nushell.github.io/pull/1114 for an
example.
2023-12-06 18:52:06 +01:00
Stefan Holderbach
3836e70d68
Change uses of size to str stats (#647)
Deprecation will be released with `0.87`
- ~~https://github.com/nushell/nushell/pull/10772~~
- https://github.com/nushell/nushell/pull/10798

Final removal in `0.88`


Land before: 
- https://github.com/nushell/nushell/pull/10784
2023-12-06 18:27:41 +01:00
Max Brown
bc309ff07d
Create basic-git.nu (#687)
It's a really simple and naive git status implementation for the prompt
in nushell. Tested on the latest version of nushell.
2023-12-06 11:23:27 -06:00
fj0r
f82c1b03e6
container-create -w: mount $env.PWD as workdir (#686)
container-create -w: mount $env.PWD as workdir

Co-authored-by: nash <nash@iffy.me>
2023-12-06 06:27:59 -06:00
RGBCube
735831e125
Fix typo in bat aliases (#684) 2023-12-02 15:40:40 -06:00
fj0r
55ef44ad3e
generate completions from tree-shaped data (#683)
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>
2023-12-01 19:44:40 -06:00
fj0r
82abb8944c
nu-complete kube deploys and pods (#682)
- 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>
2023-12-01 19:00:07 -06:00
Kuo-tung Kao
c65ae517d0
get deploy complete for ka/kl in kubernetes module (#680)
`kubectl exec` and `kubectl log` support a deployment as argrument.
Get deployment for completion
2023-11-29 09:12:59 -06:00
Gabin Lefranc
0a5c82274f
Add record module (#679)
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 😉 )
2023-11-29 09:12:23 -06:00
fnuttens
2f8dee98ae
Add bat aliases (#678)
See https://github.com/sharkdp/bat
2023-11-29 09:11:31 -06:00
Antoine Stevan
91b6a2b228
add clip from standard library (#674)
related to
- https://github.com/nushell/nushell/pull/11097

## description
this PR is a companion to https://github.com/nushell/nushell/pull/11097
and moves the `std clip` command from the standard library to the new
`modules/system` directory module.

a [new
section](https://github.com/amtoine/nu_scripts/tree/move-clip-from-std/modules#system)
has been added to the README of `modules/`.
2023-11-22 18:25:23 +01:00
WindSoilder
06d3095ab1
Using def --env instead of def-env (#673) 2023-11-20 06:55:35 -06:00
fj0r
9d02fb1ef8
rename cmd parse to argx to improve importing (#671)
- 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>
2023-11-17 20:47:01 -06:00
WindSoilder
09d6c7e437
remove null-stream (#670)
It's a follow up to https://github.com/nushell/nushell/pull/11070
2023-11-17 09:16:21 -06:00
fj0r
6a40ceb3db
cwdhist: can place the path anywhere in the buffer (#669)
- git, kubernetes: upgrade cmd parse

---------

Co-authored-by: nash <nash@iffy.me>
2023-11-17 07:49:58 -06:00
Stefan Holderbach
99fe279311
Change nu-deps script to not care about waves (#667)
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.
2023-11-14 18:19:19 +01:00
Stefan Holderbach
1fd3a3fa6a
Update nu_release.nu for 0.87 release (#668)
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
2023-11-14 17:33:24 +01: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
27ffa41815
cwdhist: remove sqlite3 dependency (#661)
- empty-sqlite: dump pre-created empty sqlite database
    - rebind open_command_editor
    - typo: system-pune-all

Co-authored-by: nash <nash@iffy.me>
2023-11-11 10:25:50 -06:00
Antoine Stevan
77f7b40828
fix the TOC of the release note template (#664)
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
2023-11-11 16:30:04 +01:00
Antoine Stevan
4d165fa510
fix the indentation of the comments in the release note template... (#663)
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 👀
2023-11-11 16:17:55 +01:00
Antoine Stevan
63fa27f702
add a command to get last release date in the release note template (#662)
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.
2023-11-11 16:00:03 +01:00
Antoine Stevan
e5e0ef6f7b
complete the release note template (#637)
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
2023-11-11 15:43:59 +01:00
Antoine Stevan
d233262a35
add a few enhancements to the create-pr script for releases (#642)
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
2023-11-11 15:38:57 +01:00
Antoine Stevan
7d843e5c7b
make list-merged-prs a module and add template example (#636)
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.
2023-11-11 15:36:38 +01:00
fnuttens
93c8ea20d7
Add git aliases (#660)
- gbm: rename branch
- gbmc: rename current branch
- gbsn/gbso: bisect new/old
- gfa: fetch and prune all remote
- glod~glols: pretty logs
- gshs: show commit message
- gsta: create stash
2023-11-09 06:29:41 -06:00
fnuttens
db6396958a
Add git push origin --delete aliases (#659)
The --dry-run option is moved to gpy — I feel like it's not such a
useful command.
2023-11-07 08:38:29 -06:00
fj0r
3dc1141403
shift_alt_e to switch cwdhist history mode (#658)
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>
2023-11-05 21:16:17 -06:00
fj0r
df2556b993
change cwdhist_menu layout to list (#657)
Co-authored-by: nash <nash@iffy.me>
2023-11-05 19:16:05 -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
fnuttens
c2bb125a67
Fix git hard reset to origin branch alias (groh) (#654)
An extra '$' was preventing the command from working.
2023-10-31 12:09:51 -05:00
Antoine Stevan
8add04deb8
update the nu-themes readme (#652)
related to
-
https://discord.com/channels/601130461678272522/601130461678272524/1167879553918705705

## description
this PR updates the README of the `nu-themes` module in the `nu-scripts`
package:
- fix the path with `themes/nu-themes/` instead of `themes/themes/`
- adds some instructions to use `nupm`

> **Note**
> see the [new README
here](https://github.com/amtoine/nu_scripts/tree/update-nu-themes-readme/themes#use-a-colorscheme)
2023-10-29 07:55:13 -05: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
Antoine Stevan
14459f923b
make hooks a module (#650) 2023-10-23 19:51:49 +03:00
Antoine Stevan
cc0719bdad
make the themes a module (#648)
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
```
2023-10-23 18:25:04 +02:00
Hullabaloo-and-Howdy-Do
2fa5caa586
null-stream.nu as stdlib-candidate (#649)
This is a way to redirect to a null stream with the same syntax
regardless of platform.
2023-10-23 17:57:50 +02:00
Antoine Sébert
7b2856ddff
fix: replace -c ['name' 'connection'] by --column { name: connection } (#646)
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 }
```
2023-10-19 15:28:19 -05:00
Antoine Stevan
ed9165fda1
fix removed commands (#645)
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.
```
2023-10-19 19:35:23 +02:00
Eric Hodel
c93ce14fc9
Improved CDPATH (#644)
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
2023-10-19 06:35:32 -05:00
fj0r
c39a41ad2d
replace def-env with def --env (#641)
- upgrade to 0.86

Co-authored-by: agent <agent@nuc>
2023-10-18 06:25:54 -05:00
fj0r
0a030b524b
upgrade to 0.86 (#640)
- upgrade to 0.86
- power.nu: new time's colorscheme `rainbow`

Co-authored-by: agent <agent@nuc>
2023-10-17 20:34:20 -05:00
Alexandre Nédélec
35669a39a9
Move def before extern in winget-completions.nu (#638) 2023-10-15 17:03:53 -05:00
Antoine Stevan
bc89655422
make_release: do not annotate boolean switches in public API (#635)
related to
- https://github.com/nushell/nushell/pull/10456
- https://github.com/nushell/nushell.github.io/pull/1071

## description
after the changes on boolean switches from
https://github.com/nushell/nushell/pull/10456, we need to not annotate
then with `: bool` when part of a public API.

this PR is required for
https://github.com/nushell/nushell.github.io/pull/1071 to move forward.
2023-10-14 16:19:04 +02:00