Commit Graph

6 Commits

Author SHA1 Message Date
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 Sébert
45c051dad0
Add dfr before into df and into nu (#585)
It seems that the file is slightly out-of-date.
2023-08-24 06:11:39 -05:00
fj0r
b06dfb664e
ssh complete cache use whitelist (ignore known_hosts and keys) (#553)
docker run add -p(privileged) option
    nvc nvdc for neovim remote-ui

Co-authored-by: agent <agent@nuc>
2023-07-15 06:57:23 -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
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 4918d3633c.

* 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