esa.ioにファイル・ディレクトリをインポートする

esa.ioCLI、kasaにインポート機能を追加した。

github.com

ファイルをインポートすることもできるし

$ echo test > test.txt

$ kasa import test.txt hello/world
https://winebarrel.esa.io/posts/1

$ kasa cat hello/world
test

$ kasa import test.txt hello/
https://winebarrel.esa.io/posts/2

$ kasa cat hello/test.txt
test

標準入力からインポートすることもできる。

$ echo test | kasa import - hello/world2
https://winebarrel.esa.io/posts/3

$ kasa cat hello/world2
test

また、ディレクトリをインポートすることもできる。

$ tree foo
foo
├── bar
│   └── zoo.txt
└── baz.txt

$ kasa import foo import/
https://winebarrel.esa.io/posts/4
https://winebarrel.esa.io/posts/5

$ kasa ls import/
2022-01-02 03:45:00  -  https://winebarrel.esa.io/posts/4    import/bar/zoo.txt
2022-01-02 03:45:01  -  https://winebarrel.esa.io/posts/5    import/baz.txt