Skip to content

winebarrel/kasa

Repository files navigation

kasa ☂️

CI

CLI for esa.io.

Usage

Usage: kasa --team=STRING --token=STRING <command>

Flags:
  -h, --help            Show context-sensitive help.
      --version
      --team=STRING     esa team ($ESA_TEAM)
      --token=STRING    esa access token ($ESA_TOKEN)
      --debug           Debug flag.

Commands:
  append --team=STRING --token=STRING --body=STRING <path>
    Append text to a post.

  cat --team=STRING --token=STRING <path>
    Print a post.

  comment --team=STRING --token=STRING --body=STRING <path>
    Comment on a post.

  cp --team=STRING --token=STRING <source> <target>
    Copy posts.

  edit --team=STRING --token=STRING --editor=STRING <path>
    Edit a post.

  import --team=STRING --token=STRING <src> <path>
    Import a file or directory.

  info --team=STRING --token=STRING <path>
    Show a post info.

  ls --team=STRING --token=STRING [<path>]
    List posts.

  mv --team=STRING --token=STRING <source> <target>
    Move posts.

  mvcat --team=STRING --token=STRING <from> <to>
    Rename a category.

  open --team=STRING --token=STRING <path>
    Open a post in the browser.

  post --team=STRING --token=STRING [<path>]
    Create/Update a post.

  rm --team=STRING --token=STRING <path>
    Delete posts.

  rmi --team=STRING --token=STRING <path>
    Delete a post by number.

  search --team=STRING --token=STRING <query>
    Search posts.

  stats --team=STRING --token=STRING
    Print team statistics.

  tag --team=STRING --token=STRING <path>
    Tagging posts.

  tags --team=STRING --token=STRING
    Print tags.

  touch --team=STRING --token=STRING <path>
    Create an empty post.

  unwip --team=STRING --token=STRING <path>
    Unwip posts.

  wip --team=STRING --token=STRING <path>
    Make posts WIP.

  install-completions --team=STRING --token=STRING
    Install shell completions

Run "kasa <command> --help" for more information on a command.

Example

$ export ESA_TEAM=winebarel
$ export ESA_TOKEN=...

$ kasa ls
2021-09-07 11:07:44  -    https://winebarrel.esa.io/posts/1        README

$ echo hello | kasa post -b - -n title -c foo/bar
https://winebarrel.esa.io/posts/38

$ kasa cat foo/bar/title
hello

$ echo world | kasa post 38 -b -
https://winebarrel.esa.io/posts/38

$ kasa cat foo/bar/title
world

$ kasa mv foo/bar/ zoo/
mv 'foo/bar/title' 'zoo/'
Do you want to move posts? (y/n) [n]: y

$ kasa ls
2021-09-07 11:07:44  -    https://winebarrel.esa.io/posts/1        README
2022-01-09 09:47:24  WIP  https://winebarrel.esa.io/posts/38       zoo/title

$ kasa ls zoo/
2022-01-09 09:47:24  WIP  https://winebarrel.esa.io/posts/38       zoo/title

$ kasa post foo/bar/title -t tagA
https://winebarrel.esa.io/posts/38

$ kasa ls '#tagA'
2022-01-09 09:47:24  WIP  https://winebarrel.esa.io/posts/38       zoo/title  [#tagA]

$ kasa mv '#tagA' baz/
mv 'zoo/title' 'baz/'
Do you want to move posts? (y/n) [n]: y

$ kasa ls
2021-09-07 11:07:44  -    https://winebarrel.esa.io/posts/1        README
2022-01-09 09:47:24  WIP  https://winebarrel.esa.io/posts/38       baz/title  [#tagA]

$ kasa rm baz/
rm 'baz/title'
Do you want to delete posts? (y/n) [n]: y

$ kasa ls
2021-09-07 11:07:44  -    https://winebarrel.esa.io/posts/1        README

$ kasa edit any/new/post
https://winebarrel.esa.io/posts/39

$ echo hello | kasa import - any/import/post
https://winebarrel.esa.io/posts/40

$ date > hello
$ kasa import hello any/import/
https://winebarrel.esa.io/posts/41

$ kasa ls any/import/
2023-08-18 10:12:00  -    https://winebarrel.esa.io/posts/40       any/import/post
2023-08-18 10:12:30  -    https://winebarrel.esa.io/posts/41       any/import/hello

$ mkdir foo/
$ touch foo/bar.txt
$ mkdir foo/zoo
$ touch foo/zoo/baz.txt

$ kasa import ./foo/ any/import2/
https://winebarrel.esa.io/posts/42       any/import2/bar.txt
https://winebarrel.esa.io/posts/43       any/import2/zoo/baz.txt

$ kasa ls any/import2/
2023-08-18 10:32:00  -    https://winebarrel.esa.io/posts/42       any/import2/bar.txt
2023-08-18 10:22:30  -    https://winebarrel.esa.io/posts/43       any/import2/zoo/baz.txt

Installation

# OSX or Linux
brew install winebarrel/kasa/kasa

Install shell completions

kasa install-completions >> ~/.zshrc