preaction / Statocles

Static website CMS
http://preaction.me/statocles
Other
84 stars 33 forks source link

Add blog list command #511

Open preaction opened 7 years ago

preaction commented 7 years ago

I frequently find myself typing find blog -depth 4 -type d to list all the blog posts. It would be nice is there was a command that could list all the blog posts, parsing the date that they are displayed, and showing whether they are published or not (and if not, why). The list should be sorted by date, ascending. The list should appear like so:

2015-01-01 blog/2015/01/01/my-first-post/index.markdown My First Post

The first field should be the date in YYYY-MM-DD format. The second field should be the path to the post file. The title should be placed after.

If the post is not published (technically, if it would not be published by doing a deploy right now), there should be a tag in parentheses after the post path indicating why: (draft) for posts with status: draft in them, and (pre) for posts with dates in the future.

2015-01-02 blog/2015/01/02/what-i-had-for-dinner/index.markdown (draft) What I had for Dinner
3014-01-03 blog/3014/01/03/my-future-post/index.markdown (pre) My Future Post

ANSI color codes may be nice, but are not a requirement (I'm not sure if they work on Windows). Future enhancements will include options for filtering posts by status (published, draft), date range, tags, or other things.