ツール名がうろ覚えのとき候補を探したい
jqのようにインストールしたいツールの正確な名前が分かっていれば【mise】mise useでプロジェクトにツールバージョンを設定する
で済む。ツール名がうろ覚えの場合や、似た用途のツールを見比べたい場合はmise searchでキーワード検索できる。
mise search <キーワード>で検索する
引数にキーワードを渡すと、レジストリからマッチするツールの一覧を表示する。
$ mise search jq
jq Command-line JSON processor. https://github.com/jqlang/jq
jqp A TUI playground to experiment with jq. https://github.com/noahgorstein/jqp
jaq A jq clone focussed on correctness, speed, and simplicity. https://github.com/01mf02/jaq
jiq jid on jq - interactive JSON query tool using jq expressions. https://github.com/fiatjaf/jiq
gojq Pure Go implementation of jq. https://github.com/itchyny/gojq
jq本体だけでなく、jqに似た名前の派生ツール(jqp、jaqなど)も一緒に表示される。【mise】mise registryでツール名とバックエンドの対応を確認する
で紹介したmise registry <name>は、指定した名前がレジストリのキーと完全一致した場合にバックエンドを1件返すコマンドで、キーワードから候補を探す用途には向かない。名前がうろ覚えのときや類似ツールを比較したいときはmise search、ツール名が確定していてバックエンドを確認したいときはmise registry、と使い分ける。
–match-typeで一致方法を変更する
デフォルトの一致方法はfuzzy(あいまい一致)である。--match-typeでequal(完全一致)、contains(部分一致)に変更できる。
$ mise search --match-type equal jq
jq Command-line JSON processor. https://github.com/jqlang/jq
equalを指定すると、ツール名がjqと完全一致する1件だけに絞り込まれる。
$ mise search --match-type contains json
cfssljson cfssljson: Takes the JSON output from Cloudflare's cfssl and multirootca programs and writes certificates, keys, CSRs, and bundles to disk.. https://github.com/cloudflare/cfssl/cfssljson
ejson EJSON is a small library to manage encrypted secrets using asymmetric encryption. https://github.com/Shopify/ejson
go-jsonnet This an implementation of Jsonnet in pure Go. https://github.com/google/go-jsonnet
hcl2json Convert hcl2 to json. https://github.com/tmccombs/hcl2json
iam-policy-json-to-terraform Small tool to convert an IAM Policy in JSON format into a Terraform aws_iam_policy_document. https://github.com/flosell/iam-policy-json-to-terraform
json5 JSON5 is an extension to the popular JSON file format that aims to be easier to write and maintain by hand (e.g. for config files). It is not intended to be used for machine-to-machine communication. (Keep using JSON or other file formats for that. 🙂). https://www.npmjs.com/package/json5
jsonnet-bundler A jsonnet package manager. https://github.com/jsonnet-bundler/jsonnet-bundler
jsonschema The CLI for working with JSON Schema. Covers formatting, linting, testing, bundling, and more for both local development and CI/CD pipelines. https://github.com/sourcemeta/jsonschema
containsはツール名にjsonという文字列を含むものを、大文字・小文字を区別せずすべて拾う。
fuzzy検索は似た文字列が見つからないとエラーになる
fuzzy検索は「文字列の一部が入れ替わっていても近い名前なら拾ってくれる」ものではなく、キーワードの各文字を順番通りに含む名前だけを候補にする方式である。該当する名前が1件もない場合、空の一覧ではなくエラー終了する。
$ mise search jqx
mise ERROR tool jqx not found in registry
jqxという文字列をj→q→xの順で含むツール名がレジストリに存在しないため、この結果になる。シェルスクリプトからmise searchを呼び出す場合は、ヒットなしのケースを終了ステータスで判定する必要がある。
–interactiveで対話的に絞り込む
-i/--interactiveを付けると、入力しながら候補を絞り込めるインタラクティブなUIが起動する。
$ mise search --interactive
Tool
Search a tool
❯ jq Command-line JSON processor. https://github.com/jqlang/jq
jqp A TUI playground to experiment with jq. https://github.com/noahgorstein/jqp
jiq jid on jq - interactive JSON query tool using jq expressions. https://github.com/fiatjaf/jiq
gojq Pure Go implementation of jq. https://github.com/itchyny/gojq
/jq
esc clear filter • enter confirm
ツール名がまったく思い浮かばないときに、キーワードを打ちながら候補を眺めるのに向いている。
–no-headerでヘッダー行を消す
端末で実行すると1行目にTool、Descriptionのヘッダーが表示されるが、パイプに渡した場合など標準出力が端末でないときはヘッダーが自動的に省略される。端末上でヘッダーだけを消したい場合は--no-headerを付ける。
