sample_post.R

#!/usr/bin/env Rscript

x <- readLines("README.md", encoding="UTF-8")
y <- x[grep("weixin", x)]
y <- y[grep("^\\+", y)]
res <- sample(y, 8)
res <- res[order(nchar(res, type="width"))]

res <- paste("\n**往期精彩**\n",
          paste(res, '\n', collapse=""))

clipr::write_clip(res, allow_non_interactive = TRUE)

message("sample posts were copied to clipboard")
GuangchuangYu/biobabble documentation built on Sept. 28, 2021, 1:33 a.m.