Script for adding curent path to `zoxide` complete
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 35/100
- issue の種類
- ドキュメント
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- shell
調査の方向性
まず external_completers.md を読み、外部 completer の例がどのように示されているかを確認します。issue で言及されている引数なしの場合とパスプレフィックスの場合を含め、提案された Nushell スニペットを検証します。ドキュメント化された例が zoxide の補完とともにカレントディレクトリのエントリを確実に追加できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I like using zoxide as a replacement for cd, so I also like having the tab complete have the current dirs in the directory in addition to the zoxide complete.
I'm not too sure in my own nushell code, so I don't want to make a pull request, but I'd like to share how I added the current dir to my zoxide complete.
let zoxide_completer = {|spans|
let path = ($spans.1 | glob $"\(?i\)($in)*" | where {path type | $in == dir} | each {path relative-to (glob "." | first)})
let zoxide = ($spans | skip 1 | zoxide query -l ...$in | lines | where {|x| $x != $env.PWD})
($zoxide | prepend $path)
}
this addition to the completer allows you to do this:
The first two entries are from the current dir, the second two are from zoxide.
There are a few places this script can fail. Firstly being with the path relative-to command. It will straight up fail if the prefix can't be found. I have an immutable distro so my /home/user folder is linked to the /var/home/user folder. This makes it unreliable to use $env.PWD as this will be different from what glob returns, so I just glob . instead, lol. Also, I'm unsure if spans always return more than one element. It seems to work with no arguments, but I don't know how it works.
I'm sure there are better ways of doing this and such, but it works for me. Just wanted to share if anyone wanted to refine it and add it to the external_completers.md file.
- 主要言語
- TypeScript
- スター
- 258
- フォーク
- 561
- 平均マージ
- 3時間 20分
- マージ済み PR(30日)
- 15
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nushell/nushell.github.io のほかの issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 68/100
nushell/nushell.github.io#2081 · コメント 3 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
nushell/nushell.github.io#767 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
nushell/nushell.github.io#2232 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
nushell/nushell.github.io#2209 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
nushell/nushell.github.io#2194 ·
nushell/nushell.github.io の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
mksglu/context-mode#1200 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
anthropics/claude-code#96687 ·
-
good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
AOSSIE-Org/DebateAI#582 · コメント 2 件 ·