Skip to content

Instantly share code, notes, and snippets.

@wogong
Created December 13, 2020 17:07
Show Gist options
  • Save wogong/d6e880e191368b502aec95ed84fa1180 to your computer and use it in GitHub Desktop.
Save wogong/d6e880e191368b502aec95ed84fa1180 to your computer and use it in GitHub Desktop.
flomo shell function
#!/bin/sh
fl () {
API="https://flomoapp.com/iwh/xxxxxxx/" # substitute with your flomo API
curl -s -H "Accept: application/json" -H "Content-type: application/json" -s -X POST $API -d '{"content":"'"$*"'"}'
}
@wogong
Copy link
Author

wogong commented Dec 13, 2020

  1. 下载 flomo shell 函数文件
wget https://gist.githubusercontent.com/wogong/d6e880e191368b502aec95ed84fa1180/raw/bed59d7b1081fc81dd4a392c988d26444e3967f9/flomo.sh
  1. 将文件内容追加到你常用的 shell 配置文件中,cat flomo.sh >> .bashrc 或者 cat flomo.sh >> .zshrc,更新 API 字段,可以从 flomo 官网获得,链接 https://flomoapp.com/mine?source=incoming_webhook

  2. 重启终端或者手动重载配置文件 source .bashrcsource .zshrc

  3. 使用:在命令行中通过 fl <notes> 语法,添加笔记到 flomo.

@prnake
Copy link

prnake commented Dec 14, 2020

第四行这样写可以返回 msg 内的内容
echo `curl -s -H "Accept: application/json" -H "Content-type: application/json" -s -X POST $API -d '{"content":"'"$*"'"}' | sed 's/[{}"]//g' | sed 's/[,:]/\n/g' | tail -n1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment