プログラミング

carbon-now-cliでスクリプトコードの画像をクールに生成する

LinuxのBash言語上のコマンドラインやWindowsのコマンドライン上で動作するのコマンドラインツール、carbon-now-cliでスクリプトコードのスニペット画像をかっこいい感じに生成する方法について紹介します。

https://yuis.xsrv.jp/data/aLX8GoycF9f45PdV2b9YUkvrN0oiEWsn.png

https://yuis.xsrv.jp/images/ss/ShareX_ScreenShot_2b256a78-c9da-4ac7-91e5-e9a07f033095.gif

# installation
npm i -g carbon-now-cli

mixn/carbon-now-cli: 🎨 Beautiful images of your code — from right inside your terminal.

WSLには、ヘッドレスchromeブラウザのPuppeteerにておなじみのエラーが出るため、インストールできません。

Puppeteer doesn’t run under WSL (Windows subsystem for Linux) · Issue #1837 · GoogleChrome/puppeteer
Running on WSL · Issue #3783 · GoogleChrome/puppeteer

使用例

$ cat tmp02.sh


remotepc-music-repeat(){
  [[ ! "$( getActiveWindowName )" == "explorer.exe" ]] && { error Active application must be explorer.exe. ; return 1 ; }
  # ahkprint <<< "send, {down}" ; sleep 0.2
  ahkprint <<< "send, {F2}" ; sleep 0.2
  # telegram-sendMessage "$( getSelectedText )" ; sleep 0.2 # no need of urlencode # 文字化け
  ahkprint <<< "send, ^c" ; sleep 0.2
  telegram-sendMessage "$( ch )"
  ahkprint <<< "send, {Enter}" ; sleep 0.2
  ahkprint <<< "send, {Enter}" ; sleep 0.2
}

$ carbon-now -ho tmp02.sh

-oオプションでブラウザで開き、グラフィカルな編集ができるようになります。

https://yuis.xsrv.jp/images/ss/ShareX_ScreenShot_e125eedd-8e55-4ade-9842-9f0c7d14fb6c.gif

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です