1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-07-31 14:17:45 +00:00
Commit graph

204 commits

Author SHA1 Message Date
fj0r
551b1816db
git-v2: imporve message of gp (#738)
Co-authored-by: nash <nash@iffy.me>
2024-01-17 08:37:13 -06:00
fj0r
30d386e363
upgrade to 0.89 (#729)
Co-authored-by: nash <nash@iffy.me>
2024-01-10 06:40:24 -06:00
fj0r
0632778754
comma: upgrade template (#725)
- README.md: delete the content of template and replace it with a link
- comma_test: T/F execute a closure and return a true or false
- comma_tmpl: add example of building image

---------

Co-authored-by: nash <nash@iffy.me>
2024-01-05 06:05:07 -06:00
fj0r
0d55be71ea
kubernetes to docker-compose (#726)
- kubernetes to docker-compose
- rearrange helm related commands

Co-authored-by: nash <nash@iffy.me>
2024-01-04 08:14:53 -06:00
Bob Hyman
cc4e573a24
Show activated python VE at beginning of prompt. (#722)
By default, the script that activates a python virtual environment for
nushell blindly prepends the virtual environment name to the existing
prompt, which causes the full-line prompt to wrap.
This change shows the virtual environment name properly positioned in
the prompt line.

To activate a python virtual environment with a pretty prompt:
```nu
---------------------------------------------------------- ~ ------------------------------------------------------- |V|
> $env.VIRTUAL_ENV_DISABLE_PROMPT = true; overlay use ve/mp2/bin/activate.nu
(mp2) ------------------------------------ ~/src/rust/nushell_worktrees/main ------------------------- [main ≡] --- |.V|
> 
```
(the unobvious environment prefix is the subject of
nushell/nushell#11469)
2024-01-02 10:53:37 -06:00
fj0r
9b7c1772e2
comma test runner (#715)
- Stabilized the format
- Test suit runner
- Support batch mode
- Watch supports postpone
- `settings.theme`
- docker.nu Simplify process-list logic

---------

Co-authored-by: nash <nash@iffy.me>
2023-12-29 09:49:28 -06:00
Ed Howland
b2fb2b441b
Adds Modules/recursion : Examples of Fun with Recursive functions in Nu (#717)
This directory contains some examples of running recursive algorithms in
Nu. It also has the module : tramp which implements the Trampoline
pattern to overcome the lack of Tail Call Optimization (TCO) avoiding
unlimited stack growth.

---------

Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
2023-12-27 13:04:52 -06:00
Mikko Viitamäki
606c33274b
fix broken links in modules readme (#718)
Checked the internal links with
[lychee](https://github.com/lycheeverse/lychee):
`
lychee.exe --offline modules\README.md
`
and I tried to fix links to new locations.

Co-authored-by: Mikko Viitamäki <mikko.viitamaki@logisnext.eu>
2023-12-25 08:08:15 -06:00
fj0r
ab5f40b59c
merge container-inspect into container-process-list (#711)
The behavior of container-process-list and image-list when argument is
passed in is to `inspect`

Co-authored-by: nash <nash@iffy.me>
2023-12-22 07:04:26 -06:00
fj0r
779d2f8639
comma: support filter, watch, poll (#707)
- Supports `computed`, the definition method refers to
`$env.comma_scope.computed`, accepts two parameters, runtime parameters
and `$env.comma_scope`
- Supports `filter`, similar to `computed`, but only runs when declared,
specified through `$env.comm.flt`
- Supports `watch`, specified through `$env.comm.wth`. Support polling
like 'poll:2sec'

---------

Co-authored-by: nash <nash@iffy.me>
2023-12-21 07:27:36 -06:00
Kuo-tung Kao
860a52a55d
fix git-v2 and kubernetes (#703)
- use `-i` instead of `-n` for table command.
- wrapped is needed for args
2023-12-20 06:03:55 -06:00
fj0r
fce44fbbfd
new module comma and some updates (#704)
update:
- cwdhist: openeditor changed from alt+e to alt+o
- docker: pull, push add nerdctl insecure-registry support
- docker: registry show use curl instead http get (may cause dns
resolution problems)
- git: status `table -n` changed to `table -i`

new module: comma

Similar to `pwd-module`, but supports completion and description through
custom data formats
- `,` or `*` need to be exported in order to use `,` directly
- Directly execute `,` to create a new template file or edit an existing
file
- Custom tasks are written in `$env.comma` and can be nested
- Generate completions based on the structure of `$env.comma`
- You can use closure to customize completion
- In `$env.commax.act` of default closure, you can receive parameters
after the current position
- In `$env.commax.cmp` , you can receive the parameter before the
current position

---------

Co-authored-by: nash <nash@iffy.me>
2023-12-20 06:03:20 -06:00
Darren Schroeder
6f1c0dfef2
fix weather script 2023-12-14 07:02:30 -06:00
张亚飞
2503468725
Fix: nushell at 0.88.0 start and end are deprecated (#698)
This resolves: #697
2023-12-14 06:40:44 -06:00
RGBCube
9700391563
Rewrite and expand background task module (#691)
Also renamed the module to task instead of job,
https://www.nushell.sh/book/background_task.html will need updating.

Other than that, this should work.

---------

Co-authored-by: RGBCube <RGBCube@users.noreply.github.com>
2023-12-12 13:06:14 -06:00
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
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
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
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
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
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
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
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
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
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
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
Bob Hyman
907612cc70
Add widget for nu exe (debug/release, and main vs other branch) (#634)
Full line prompt looks like:
```
---<exeStatus>---------- <workingDirectory> ------ <gitRepoStatus> --- <dirs>
>
```
Where `<exeStatus>` shows `<exe-path> <exe-branch>`, 
but is empty if:
* nu exe running from a "bin" folder (based on `$nu.current-exe` path)
* nu exe built from a "main" branch (otherwise shows `(version | get
branch)`)
2023-10-14 06:35:05 -05:00
Piepmatz
85da8c2fb5
Use Existing Path Env Var for FNM (#632)
The module for `fnm` did not set the path for Windows correctly. I fixed
it by searching for the used `Path` variable (or `PATH`) and use that
instead.

Works now better on Windows without breaking other OSes.
2023-10-07 16:25:15 +02:00
fj0r
c9d63946ec
mask-completions (#631)
- mask-completions
- kubernetes: rename kgpw to kwp

---------

Co-authored-by: agent <agent@nuc>
2023-10-07 12:26:58 +02:00
Sam Vente
150105f93f
Add gnu wc wrapper (#625)
Wasn't quite sure where to place this, if anyone has a better place for
it please let me know. It's a nice wrapper around the gnu `wc` command
that gives you named columns back. Nice imo, since I always forget which
number means which.
2023-09-30 17:14:19 -05:00
Antoine Stevan
9d21cd5cd3
Add cartesian product to math module (#624)
related to
- https://github.com/nushell/nushell/pull/10383

this PR resurrects the `cartesian product` command from
https://github.com/nushell/nushell/pull/10383 and adds it to the `maths`
module of the `nu_scripts`:
- a new `cartesian product` command
- some unit tests for it

## use the command
i've installed the `nu_scripts` with `nupm`, thus i'm able to do
```nushell
use nu-scripts/modules/maths/math_functions.nu "cartesian product"
cartesian product ...
```

## run the tests
from the root of the `nu_scripts`, checked out on this PR, run
```nushell
use std; std testing run-tests --path modules/maths/ --test cartesian_product
```
2023-09-30 09:46:04 -05:00
Stefan Holderbach
6947014306
Replace use of $nothing with null (#621)
`$nothing` will be deprecated in nu 0.86

This accompanies
- https://github.com/nushell/nushell/pull/10478
2023-09-26 18:52:49 +02:00
marcel
c3086bc833
only change func name (#614) 2023-09-22 18:20:22 +02:00
fj0r
470ad04bc5
git-v2: new command gcf for copying files from other branch (#616)
`_git_log`: use `git --reverse` instead of nushell's reverse
        `nu-complete git log all`(gcp): show tags of all branches
        rename `gcf` to `gcl`
        new `gcf` for copying files from other branch

Co-authored-by: agent <agent@nuc>
2023-09-22 07:45:59 -05:00
Stefan Holderbach
36a45f28a3
Move random/into decimal to random/into float (#606)
* Move `random-list decimal` to `random-list float`

Updates internally to `random float` published with `0.85`

* Update kubernetes wrapper to `into float`

* Update temp script to `into float`

* Update `nupass` to `random float`
2023-09-20 19:13:52 +02:00
fj0r
2cbd0de3d4
kubernetes/kn: create namespace when it doesn't exist (#610)
* kubernetes/kn: create namespace when it doesn't exist

* upgrade to 0.85: decimal -> float

---------

Co-authored-by: agent <agent@nuc>
2023-09-20 06:30:48 -05:00
WindSoilder
920cf73cbb
Improve background job.nu (#607)
* add Q&A session in README, and add `--label`, `--group` flag to spawn, add `output` sub command to acquire output easily

* make detailed to be a flag
2023-09-14 06:28:08 -05:00
Marshall Bruner
8260da5fb9
Change nu_conda list to output active status of environment as well (#604) (#605) 2023-09-12 14:50:42 -05:00
WindSoilder
e61b94efce
use closure instead of block (#602) 2023-09-12 08:41:12 -05:00
daniel sieradski
411496d311
Add support for fnm (#593)
* add fnm

Signed-off-by: Daniel Sieradski <daniel@self.agency>

* restore path list

---------

Signed-off-by: Daniel Sieradski <daniel@self.agency>
2023-09-08 06:18:55 -05:00