LoginSignup
6
6

More than 5 years have passed since last update.

ターミナルから Kobito へ文字列を送信する

Posted at

以下のファイルをパスが通った場所に保存し、実行権限をつけておく。

kobito
#!/usr/bin/ruby

if File.pipe?(STDIN) && data = STDIN.read
  path = "/tmp/kobito#{Time.now.to_i}.md"
  File.open(path, "w") { |io| io.print data }
  system "open -a Kobito '#{path}'"
  File.delete(path)
end

あとは、

% history | tail -n 5 | kobito

とか、

% pbpaste | kobito

のように実行すると、Kobito にターミナルから実行結果などを流し込める。コマンドの実行手順とかをメモするときに便利かもしれない。

(Kobito が AppleScript に対応していたりすると、ファイルにいったん書き出したりする必要がなくなるのかもしれない。標準の機能で同様のことができると嬉しいかも)

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6