commit 8573814c4e08e32818a688d74ad70e9babd3d727 parent 812d1ae50be691f9ff00135c64f1b799e0be9902 Author: Hugo Soucy <hugo@soucy.cc> Date: Thu, 9 Mar 2017 21:50:30 -0500 Complete the alpha version of that script. It's works :) Diffstat:
M | posse | | | 23 | +++++++++++++++++++++-- |
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/posse b/posse @@ -2,8 +2,27 @@ # https://indieweb.org/POSSE +# POSSE to Twitter via command line # https://github.com/gregkh/bti # cat example.md | bti --action update -# Remove the YAML block then pipe to bti -# sed '1 { /^---/ { :a N; /\n---/! ba; d} }' $HOME/Documents/hugosoucycc/content/note/2017/03/revanche-des-librairies-independantes.md > tmp.md && sed '1{/^ *$/d}' tmp.md | cat -s | bti --action update +# 1) Get the most recent file in the note/ directory. +dir="./content/note" + +unset -v latest_note + +IFS= read -r -d '' latest_note \ + < <(find "$dir" -type f -printf '%T@ %p\0' | sort -znr) + +latest_note=${latest_note#* } # remove timestamp + space + +# 2) With Pancdoc remove the YAML header into that file +posse_note=$(basename "${latest_note%.*}.tweet.md") + +pandoc --wrap=none "$latest_note" -o "$posse_note" + +# 3) Tweet the file content with the bti command. +cat "$posse_note" | bti --action update + +# 4) Remove the *.tweet.md +rm "$posse_note"