これは何?
esaのCLIです。 AWS CLIでs3を操作するのと同じような感覚でesaを操作できます。
使い方
see https://github.com/winebarrel/kasa#usage
最初に環境変数ESA_TOKEN
とESA_TEAM
の設定が必要です。
記事の一覧を出す
% kasa ls | head 2021-09-07 11:07:44 - https://winebarrel.esa.io/posts/1 README 2021-09-12 05:57:43 - https://winebarrel.esa.io/posts/13 Templates/hohおあ 2021-09-07 11:07:44 - https://winebarrel.esa.io/posts/3 Templates/手順書/title 2021-09-07 11:07:44 - https://winebarrel.esa.io/posts/2 Templates/日報/%{Year}/%{month}/%{day}/%{me}:title 2021-09-07 11:07:45 - https://winebarrel.esa.io/posts/4 Templates/議事録/%{Year}/%{month}/%{day}/会議名 2021-09-11 05:57:44 - https://winebarrel.esa.io/posts/5 fdsafadsfa 2022-01-09 01:56:29 - https://winebarrel.esa.io/posts/25 test3/test 2022-01-09 12:55:41 - https://winebarrel.esa.io/posts/26 雑/test (1) 2022-01-09 12:55:41 - https://winebarrel.esa.io/posts/27 雑/test (2) 2022-01-09 12:55:41 - https://winebarrel.esa.io/posts/28 雑/test (3)
カテゴリを指定して記事の一覧を出す
% kasa ls 雑/ 2022-01-09 12:55:41 - https://winebarrel.esa.io/posts/26 雑/test (1) 2022-01-09 12:55:41 - https://winebarrel.esa.io/posts/27 雑/test (2) 2022-01-09 12:55:41 - https://winebarrel.esa.io/posts/28 雑/test (3) 2022-01-09 12:55:42 - https://winebarrel.esa.io/posts/29 雑/test (4) 2022-01-09 12:55:42 - https://winebarrel.esa.io/posts/30 雑/test (5)
タグを指定して記事の一覧を出す
% kasa ls '#hoge' 2022-01-09 11:59:18 - https://winebarrel.esa.io/posts/6 雑3/test [#hoge] 2022-01-09 11:59:18 - https://winebarrel.esa.io/posts/7 雑3/ざっつ [#hoge] 2022-01-09 12:22:53 WIP https://winebarrel.esa.io/posts/19 雑3/ざっつ (1) [#hoge] 2022-01-09 11:59:18 - https://winebarrel.esa.io/posts/8 雑3/ほげ [#hoge] 2022-01-09 01:44:35 - https://winebarrel.esa.io/posts/9 雑5/fadsfd [#hoge]
記事を検索する
see https://docs.esa.io/posts/104
% kasa search wip:true 2022-01-09 12:22:53 WIP https://winebarrel.esa.io/posts/19 雑3/ざっつ (1) [#hoge] 2022-01-09 12:21:38 WIP https://winebarrel.esa.io/posts/11 雑5/fadsfasdfad
記事を出力する
% kasa cat README | head ## :hatching_chick: esa へようこそ esaは、[《情報を育てる》というコンセプト](https://esa.io/concept) で作られた、自律的なチームのためのドキュメント共有サービスです。 日報やミーティングの議事録をはじめ、仕様書やアイデアのメモなど様々なドキュメントに利用することができます。 ### :memo: 簡単な記事の書き方 - 左上の "__NEW POST__" から記事を書き始めることができます - 記事タイトル入力欄に、半角の `/` (スラッシュ) 区切りでカテゴリを作ることができます - (例)`カテゴリ1/カテゴリ2/記事タイトル` のように入力してみてください
記事を投稿する
% date | kasa post -b - -n hello -c 'foo/bar' https://winebarrel.esa.io/posts/34 % kasa cat foo/bar/hello 2022年 1月 9日 日曜日 14時41分44秒 JST
記事を更新する
% echo updated | kasa post 34 -b - https://winebarrel.esa.io/posts/34 % kasa cat foo/bar/hello updated
記事をリネームする
% kasa mv hello/world/my-title hello/world/my-title2 mv 'hello/world/my-title' 'hello/world/my-title2' Do you want to move posts? (y/n) [n]: y
カテゴリを指定して記事をまとめて移動する
% kasa ls 雑/ 2022-01-09 12:55:41 - https://winebarrel.esa.io/posts/26 雑/test (1) 2022-01-09 12:55:41 - https://winebarrel.esa.io/posts/27 雑/test (2) 2022-01-09 12:55:41 - https://winebarrel.esa.io/posts/28 雑/test (3) 2022-01-09 12:55:42 - https://winebarrel.esa.io/posts/29 雑/test (4) 2022-01-09 12:55:42 - https://winebarrel.esa.io/posts/30 雑/test (5) % kasa mv 雑/ 雑x/ mv '雑/test (1)' '雑x/' mv '雑/test (2)' '雑x/' mv '雑/test (3)' '雑x/' mv '雑/test (4)' '雑x/' mv '雑/test (5)' '雑x/' Do you want to move posts? (y/n) [n]: y % kasa ls 雑x/ 2022-01-09 02:11:05 - https://winebarrel.esa.io/posts/26 雑x/test (1) 2022-01-09 02:11:05 - https://winebarrel.esa.io/posts/27 雑x/test (2) 2022-01-09 02:11:05 - https://winebarrel.esa.io/posts/28 雑x/test (3) 2022-01-09 02:11:06 - https://winebarrel.esa.io/posts/29 雑x/test (4) 2022-01-09 02:11:06 - https://winebarrel.esa.io/posts/30 雑x/test (5)
タグを指定して記事をまとめて移動する
% kasa ls '#hoge' 2022-01-09 11:59:18 - https://winebarrel.esa.io/posts/6 雑3/test [#hoge] 2022-01-09 11:59:18 - https://winebarrel.esa.io/posts/7 雑3/ざっつ [#hoge] 2022-01-09 12:22:53 WIP https://winebarrel.esa.io/posts/19 雑3/ざっつ (1) [#hoge] 2022-01-09 11:59:18 - https://winebarrel.esa.io/posts/8 雑3/ほげ [#hoge] 2022-01-09 01:44:35 - https://winebarrel.esa.io/posts/9 雑5/fadsfd [#hoge] % kasa mv '#hoge' hello/ mv '雑3/test' 'hello/' mv '雑3/ざっつ' 'hello/' mv '雑3/ざっつ (1)' 'hello/' mv '雑3/ほげ' 'hello/' mv '雑5/fadsfd' 'hello/' Do you want to move posts? (y/n) [n]: y % kasa ls hello/ 2022-01-09 02:12:19 - https://winebarrel.esa.io/posts/9 hello/fadsfd [#hoge] 2022-01-09 02:12:18 - https://winebarrel.esa.io/posts/6 hello/test [#hoge] 2022-01-09 02:10:04 - https://winebarrel.esa.io/posts/31 hello/world/my-title2 2022-01-09 02:12:18 - https://winebarrel.esa.io/posts/7 hello/ざっつ [#hoge] 2022-01-09 02:12:18 WIP https://winebarrel.esa.io/posts/19 hello/ざっつ (1) [#hoge] 2022-01-09 02:12:18 - https://winebarrel.esa.io/posts/8 hello/ほげ [#hoge]
記事を削除する
% kasa rmi 31
タイトルを指定して記事を削除する
% kasa ls test/ 2022-01-09 02:44:27 - https://winebarrel.esa.io/posts/26 test/test (1) 2022-01-09 02:44:27 - https://winebarrel.esa.io/posts/27 test/test (2) 2022-01-09 02:44:28 - https://winebarrel.esa.io/posts/28 test/test (3) 2022-01-09 02:44:28 - https://winebarrel.esa.io/posts/29 test/test (4) 2022-01-09 02:44:28 - https://winebarrel.esa.io/posts/30 test/test (5) [#hoge,#fuga] % kasa rm 'test/test (1)' rm 'test/test (1)' Do you want to delete posts? (y/n) [n]: y % kasa ls test/ 2022-01-09 02:44:27 - https://winebarrel.esa.io/posts/27 test/test (2) 2022-01-09 02:44:28 - https://winebarrel.esa.io/posts/28 test/test (3) 2022-01-09 02:44:28 - https://winebarrel.esa.io/posts/29 test/test (4) 2022-01-09 02:44:28 - https://winebarrel.esa.io/posts/30 test/test (5) [#hoge,#fuga]
カテゴリを指定して記事をまとめて削除する
% kasa rm 雑5/ rm '雑5/2' rm '雑5/fadsfasdfad' rm '雑5/ほふぁ' Do you want to delete posts? (y/n) [n]: y
タグを指定して記事をまとめて削除する
% kasa rm '#hoge' rm 'hello/fadsfd' rm 'hello/test' rm 'hello/ざっつ' rm 'hello/ざっつ (1)' rm 'hello/ほげ' Do you want to delete posts? (y/n) [n]: y
カテゴリ名をリネームする
% kasa ls 雑x/ 2022-01-09 02:11:05 - https://winebarrel.esa.io/posts/26 雑x/test (1) 2022-01-09 02:11:05 - https://winebarrel.esa.io/posts/27 雑x/test (2) 2022-01-09 02:11:05 - https://winebarrel.esa.io/posts/28 雑x/test (3) 2022-01-09 02:11:06 - https://winebarrel.esa.io/posts/29 雑x/test (4) 2022-01-09 02:11:06 - https://winebarrel.esa.io/posts/30 雑x/test (5) % kasa mvcat 雑x/ 雑x2/ % kasa ls 雑x2/ 2022-01-09 02:11:05 - https://winebarrel.esa.io/posts/26 雑x2/test (1) 2022-01-09 02:11:05 - https://winebarrel.esa.io/posts/27 雑x2/test (2) 2022-01-09 02:11:05 - https://winebarrel.esa.io/posts/28 雑x2/test (3) 2022-01-09 02:11:06 - https://winebarrel.esa.io/posts/29 雑x2/test (4) 2022-01-09 02:11:06 - https://winebarrel.esa.io/posts/30 雑x2/test (5)
※反映まで若干タイムラグがある気がします
記事の情報を出す
% ./kasa info 1 { "number": 1, "name": "README", "full_name": "README", "wip": false, "created_at": "2021-09-07T23:07:44+09:00", "message": "Created by team initialization.", "url": "https://winebarrel.esa.io/posts/1", "updated_at": "2021-09-07T23:07:44+09:00", "tags": [], "category": "", "revision_number": 1, "created_by": { "myself": false, "name": "esa_bot", "screen_name": "esa_bot", "icon": "https://img.esa.io/uploads/production/users/83/icon/thumb_m_1bca40cedfd2cfd0f636f2ac9c0bbad6.jpg" }, "updated_by": { "myself": false, "name": "esa_bot", "screen_name": "esa_bot", "icon": "https://img.esa.io/uploads/production/users/83/icon/thumb_m_1bca40cedfd2cfd0f636f2ac9c0bbad6.jpg" } }