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

40 commits

Author SHA1 Message Date
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
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
Kuo-tung Kao
526c9525ea
fix ka command in kubernetes module (#884)
substring ..-1 not working. Use str trim to remove '-'
2024-06-24 07:00:35 -05:00
fj0r
f39976902a
kube refine for backup (#793)
- new function `kube refine`
- define the required information in `$env.KUBERNETES_REFINE`, `kube
refine` will collect information according to its definition
- definitions in `status` and `cluster_status` are runtime information
and will not be collected. They are used in the `kg` command to display
status
- normalize the output of the `kg`, `kgp`, `kgs` command using `krefine`

- rename `kcconf` to `kccc` (kubectl change context clone)

- a new module, `refine.nu`, declaratively extracts data from complex
structures.

- `container-list` additionally displays the cmd field of the image

---------

Co-authored-by: nash <nash@iffy.me>
2024-03-30 07:14:45 -05:00
fj0r
56fe4b94ff
standardized parameter naming for --help and fix regex capture (#786)
standardized parameter naming for `--help`
|old|new|
|-|-|
|img|image|
|ctn|container|
|p|file|
|ctx|context|
|ns|namespace|
|k|kind|
|r, i|resource|
|r|pod, service, deployment|
|res|kind|
|svc|service|
|d, dpl|deployment|

change `(?P<name>)` to `(?<name>)`

Co-authored-by: nash <nash@iffy.me>
2024-03-12 06:45:50 -05:00
fj0r
0fd766871f
upgrade to 0.91 (#776)
update argx.nu, docker.nu, git-v2.nu, kubernetes.nu, ssh.nu, and nvim.nu
to support 0.91 syntax.

---------

Co-authored-by: nash <nash@iffy.me>
2024-03-06 06:08:26 -06:00
fj0r
e8f4d7462a
ksi: kubectl set image (#760)
Co-authored-by: nash <nash@iffy.me>
2024-02-20 06:32:46 -06:00
fj0r
d9ba934d77
krd for kubectl redistribution deployment (#745)
Co-authored-by: nash <nash@iffy.me>
2024-01-25 05:56:20 -06:00
fj0r
e5176370f6
fix docker.nu and kubernetes.nu (#739)
updates using the spread operator

Co-authored-by: nash <nash@iffy.me>
2024-01-17 09:09:21 -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
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
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
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
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
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
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
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
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
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
fj0r
e5cf9b15ae
Upgraded to 0.84 (#583)
`gig` for editing .gitignore
export aliases of `docker.nu`
implement `kdh` without helm-diff installed

Co-authored-by: agent <agent@nuc>
2023-08-23 06:23:14 -05:00
Antoine Stevan
a61256da0e
use $env. instead of let-env (#543)
related to nushell/nushell#9574

Commands used
```nushell
sd --string-mode "let-env " '$env.' **/*
git rst before_v0.60/
```
2023-07-01 10:40:16 +02:00
fj0r
ab0d3aaad0
upgrade to 0.82 (#539)
Co-authored-by: agent <agent@nuc>
2023-06-27 21:11:03 -05:00
fj0r
039930b4e4
parse name of positional args in parse cmd (#527)
* parse name of positional args in `parse cmd`

* Fix the problem that git stashes cannot be parsed correctly

* Fix parsing failure not in git directory

---------

Co-authored-by: agent <agent@nuc>
2023-06-09 07:58:24 -05:00
fj0r
09f6d2a473
kubernetes: fix -n in completion context (#523)
Co-authored-by: agent <agent@nuc>
2023-06-05 06:58:57 -05:00
fj0r
140f556049
more precise parsing of cmd through the information in nu.scope.commands (#522)
- refactor `after` to `after`, `before`
- `gp` support `back-to-prev` for merging scenes
- `ka`, `ke`, `kep`, `ked`, `kes` supports labels selector

Co-authored-by: agent <agent@nuc>
2023-06-04 21:17:28 -05:00
fj0r
ab881a61d5
kubernetes: normalize-column-names (#518)
The column names are uppercase and spaces by default, which is inconvenient for subsequent operations and converted to lowercase and underscores

Co-authored-by: agent <agent@nuc>
2023-05-31 06:28:25 -05:00
fj0r
4a1b4c73c2
update docker, git-v2, kubernetes (#517)
- fix `dr -v`
- `gs` split into `gs` and `gst` (stash)
- `gb` add `remote` parameter
- `gn` for clone, init
- tweak `gp`, more complete condition of branches
- `gc` message as positional parameters
- `gm` split into `gm` and `gr` (rebase)
- `gm` default squash with commit
- `gr`(reset) rename to `grs`
- `gr -c` remove `-x`
- `grmt` rename to `grm`
- `gsq` rename to `ggc`
- `kah` allow `--set-json`
- `kh` using conventions instead of arguments
- `kconf import` update existing key
- `ka` (attach) support selector and interactive

Co-authored-by: agent <agent@nuc>
2023-05-30 20:55:03 -05:00
fj0r
ebc16108fb
refactor: introduce spr and sprb for spread (#504)
* refactor: introduce `spr` and `sprb` for spread

- eliminate `if ($n|is-empty) { [] } else { [-n $n] }` pattern

- `gp -u` can omit branch
- delete `grb`
- improve the premise in the description

* commands for helm as `kxh`

- add `(kustomize)` to description of kxk
- add commands for helm
    - kgh
    - kdh
    - kah
    - kdelh
    - kh
- add `nu-complete kube port` of `kpf`
- add `--local` flag for `kpf`

---------

Co-authored-by: agent <agent@nuc>
2023-05-18 06:42:27 -05:00
fj0r
524f633531
merge ktpa into ktp(-a), rename ktn to ktno (#497)
* merge ktpa into ktp(-a), rename ktn to ktno

* Add a short description to `kgpw`

* kgp support `-a`

---------

Co-authored-by: agent <agent@nuc>
2023-05-17 06:12:48 -05:00
fj0r
b6ecfe3680
Experimental multi-taskrunner support for jx (npm for example) (#492)
* Experimental multi-task runner support for `jx` (npm for example)

- Remove `nu-complete` export for debugging.
- Formatting `nu-complete just recipes`

* Use `jx` to override `j`.

Only for `just`, it only adds a prefix when completing, and does not break the original workflow

* `nu-complete just recipes` append empty string

When all the completions are `just xxx`, there is only `just` in the menu, press `C-w` to delete backwards to work.

* kgp takes `-o default` by default

move just to just/just.nu

* `gp` uses `git pull` instead of `git fetch` by default, and there is only one request when `push` is not needed

* add kgpw for `kubectl get pods --watch`

adjust `gm` to make it clearer

* remove just.nu

---------

Co-authored-by: agent <agent@nuc>
2023-05-16 20:07:08 -05:00
fj0r
632a62f035
kubernetes completion of jsonpath (#487)
* nu-complete kube jsonpath

The behavior is correct, but the completion menu cannot be displayed

* jsonpath completion for list

* New nushell-style git.nu

Original renamed to git-classic.nu

See `git.md` for details

* rename git.md to README.md

* Move the helper function to the back

* revert power_kube ensure-cache

* A more precise description of `gp`

* description of behavior that both ahead and behind exist

* clean up redundant alias

git show can use gl <hash> instead (hash can be completed)

* add description of `gl`

* add description of gp, ga, gd's parameter

* typo: gpc to gcp

* description of `gp --override`

* rename git.nu to git-v2.nu and git_classic.nu to git.nu

* `git fetch` as fallback of `gp` and temporarily disable `gstat`

temporarily disable `gstat` in `power_git` because:

- `gstat` is not much faster than nushell's implementation of `git_status`
- Sometimes the information displayed is inaccurate, but `git_status` parses the output of `git`, which is more reliable
- No need to load additional plugins

---------

Co-authored-by: agent <agent@nuc>
Co-authored-by: nash <nash@iffy.me>
2023-05-13 10:59:30 -05:00
fj0r
58a05e91da
clean up kubernetes.nu (#486)
* add the original kubectl command as description of abbreviation

* replace nu-complete kube pods, services, deployments with `res via name`

* kg support --jsonpath

* kgp, kgs, kgd support --jsonpath

* refactor kep, kdp, kgd, kdels

* kg support --selector

* kg support --wide

- remove kgpl
- kgp, kgd support --selector

* kg support --watch and rename wide to verbose

- remove kgpa (kg pod -A)
- remove kgpw (kg pod -w)

* add kind in output of `kg -v`

used with multiple types such as `kg pod,svc -v`

---------

Co-authored-by: agent <agent@nuc>
2023-05-12 06:16:07 -05:00
fj0r
2d6f32657a
improve kconf import (#481)
* improve kconf import

The order of fields loaded via `from yaml` is unstable, so use yq to
read it as json, and then load it by `from json`.

Aims to be `diff` friendly.

Remove the square brackets from the week field and use color to
distinguish it, taking up less space.

* kube_stat shows $ctx.NAME instead of complex combination of $ctx.AUTHINFO and $ctx.CLUSTER

- Improve the default theme of kube_stat.
- Clean up duplicate comments in `kubernetes.nu`.

* when power's DECORATOR mode is `power`, allows to dynamically change the background color

- components now needs to return two values in an array, the first value is the background color, and the second value is the original value.
- as an example, `atuin_stat` reveal its status with two different colors instead of showing or hiding

* allowing pass `config` when register or inject a component

The main difference between `config` and `theme` is: theme assumes you pass a color and will apply with `ansi -e {fg : $arg}`

And in most cases, you don't need to pass `config`

* added new function `power set`

time_segment allows format control via option `short`

* rename `nu-complete kube def` to `nu-complete kube kind`

- get all resources via `kubectl api-resources`
- enable cache

* use `from yaml` instead of `yq -o=json | from json` (for next version)

* nu-complete kube kind: add SHORTNAMES as description

* Fix the caching mechanism of `kube ctx` and `kube kind`

based on the number of file lines instead of modification time.

Because switching the context will change the content of the file, the time will be updated every time

* Added new command `kcache flush` to rebuild the cache.

Sometimes, such as manually editing the cluster address in the
configuration file, the number of lines has not changed, and the cache
does need to be refreshed

* use `path dirname` instead of `dirname`

* applying `ensure-cache-by-lines` in `kube_stat`

---------

Co-authored-by: agent <agent@nuc>
2023-05-11 06:37:39 -05:00
fj0r
c1e798aad4
optimize kube_stat with ensure-cache (#470)
refactor ensure-index to ensure-cache in:
- kubernetes.nu
- ssh.nu

Co-authored-by: nash <nash@iffy.me>
2023-04-28 12:34:35 -05:00
fj0r
c5865e0825
powerline : NU_POWER_MODE and NU_POWER_BENCHMARK (#464)
* powerline : NU_POWER_MODE and NU_POWER_BENCHMARK

* zoxide-menu

* direnv

* dynamic-load

* logtime

---------

Co-authored-by: agent <agent@nuc>
2023-04-26 13:36:55 -05:00
Mel Massadian
c47ccd42b8
refactor: (#418)
* refactor:  move in one commit

Eveything in modules should probably be changed to `exported` defs.
The idea is to move everything first to keep proper history.

* refactor: 📝 add modules readme (wip)

* refactor:  small move

* refactor: 📝 changed nestring, updated modules readme

* refactor: 📝 to document or not to document

* fix: 🐛 themes

replaced the template to use `main` and regenerated them
from lemnos themes.

* Revert "fix: 🐛 themes"

This reverts commit 4918d3633c8d2d81950a0ed0cfd9eb84241bc886.

* refactor:  introduce sourced

- Created a source `root` in which sourcable demos are stored.
  Some might get converted to modules later on.
- Moved some files to bin too.

* fix: 🐛 fehbg.nu

* fix: 🐛 modules/after.nu

* moved some other stuff around

---------

Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
2023-04-25 17:56:25 -05:00