From 9b50f6463f742b88e1d92384758d6f91afcd2bf8 Mon Sep 17 00:00:00 2001 From: syui Date: Wed, 31 Jul 2024 21:07:17 +0000 Subject: [PATCH] =?UTF-8?q?atproto=20=E3=82=92=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- atproto.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/atproto.md b/atproto.md index 76320a6..e65b3cf 100644 --- a/atproto.md +++ b/atproto.md @@ -36,6 +36,49 @@ url=$api/com.atproto.repo.getRecord curl -sL "$url?repo=$did&collection=$collection&rkey=$rkey&cid="|jq . ``` +## jq + +ここでは[aios](https://git.syui.ai/ai/os)にインストールされている[jq](https://github.com/jqlang/jq), [dasel](https://github.com/TomWright/dasel)の`example`をまとめます。 + +## null + +`id:3`の`name:null`を除外して表示 + +```json +[ + { + "id": 1, + "name": "aios", + "display": "ai os" + }, + { + "id": 2, + "name": "archlinux", + "display": "Arch Linux" + }, + { + "id": 3, + "display": "Linux Kernel" + } +] +``` + +```sh +$ echo $json|jq -r ".[]|{name, display}|select(.name | length > 0)|.name,.display" +aios +ai os +archlinux +Arch Linux +``` + +```sh +$ echo $json|jq -r ".[]|.name // empty" +aios +archlinux +``` + +## dasel + - https://daseldocs.tomwright.me ```sh