ぴよログ

↓に移転したのでこっちは更新されません、多分。

Kobitoのコマンドライン「kobito-cli」がめちゃ便利

移転しました →

タイトルそのままなんだけど、これめちゃくちゃ便利。個人的にはkobito pdfkobito printが便利。これでマークダウンでプレビューしながらドキュメント書いてPDFに整形も簡単にできるし。

suin/kobito-cli

Usage

これUsageそのまんま転載なんだけど、使い方もシンプルで良い。

Usage: 
  kobito [command]

Available Commands: 
  ls                                            :: List all items
  show [item id]                                :: Show item
  html [item id]                                :: Show item as HTML
  print [item id]                               :: Print out item
  link [markdown file]                          :: Link markdown file to Kobito
  version                                       :: Print kobito cli tools version
  pdf [item id] | pdf [item id] [pdf file name] :: Save item as PDF
  password                                      :: Show Kobito password
  sticker                                       :: Do you want Kobito sticker?
  help [command]                                :: Help about any command


Use "kobito help [command]" for more information about that command.

ls

% kobito ls
ITEM_ID    TITLE
    109    ほげほげほげ
    105    タイトルタイトル
    110    ああああああああああああああ
    107
     35    ◯◯について

show

% kobito show 105
タイトルタイトル

# マークダウンのテキストが

## そのまま標準出力に表示されます

html

% kobito html 105
<!DOCTYPE HTML>
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>Kobito Memo</title>
    <script type="text/javascript" src="highlight.pack.js"></script>
    <script>hljs.initHighlightingOnLoad();</script>
    <script>
      function setTitleForAllAnchors() {
        Array.prototype.map.call(document.getElementsByTagName('a'), function(a) {
          a.title = a.href;
        });
      }
      window.addEventListener('DOMContentLoaded', setTitleForAllAnchors, false);
    </script>
    <link type="text/css" rel="stylesheet" href="github.min.css">
    <link type="text/css" rel="stylesheet" href="markdown.css">
    <link type="text/css" rel="stylesheet" href="file:///Users/hiromasa/Library/Kobito/CSS/custom-style.css?time=1403160361.055531">
  </head>
  <body>
<h1>タイトルタイトル</h1>

<h1>マークダウンのテキストが</h1>

<h2>そのまま標準出力に表示されます</h2>
  </body>
</html>

print

% kobito print 105
# SafariでHTMLとして開いたあと印刷ダイアログを表示

pdf

% kobito pdf 105
# カレントディレクトリに「タイトルタイトル.pdf」

パイプ、リダイレクト

文字列を渡すとKobitoのエントリーになるみたい。

% kobito < hoge.rb
# hoge.rbの内容がKobitoのエントリーになる
% tail development.log | kobito 
# ログの最後の10行Kobitoのエントリーになる