Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A pottery show command to read recent shards
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
set -e | ||
eval "$($(dirname $0)/pottery-config)" | ||
|
||
## usage: pottery show [COUNT] | ||
## | ||
## Displays the COUNT most recent entries recorded in the history. | ||
## | ||
## If COUNT is not given, it defaults to 10. | ||
## | ||
## E.g. to show the 10 most recent entries | ||
## | ||
## pottery show | ||
## | ||
## E.g. to show the 5 most recent entries | ||
## | ||
## pottery show 5 | ||
## | ||
|
||
count=${1:-10} | ||
rootdir=$("$pottery_bin_dir/_pottery_dir") | ||
|
||
for f in $(find $rootdir -type f -name '*.md' | sort --reverse --dictionary-order | head -n $count) | ||
do | ||
f_name=$(basename $f) | ||
f_date=${f_name:0:20} | ||
echo $f_date | ||
echo | ||
cat $f | ||
echo | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
pottery init | ||
TEST_TIME=1992-01-12T16:34:23Z pottery post "First post" | ||
docs/project-history/1992/1992-01/1992-01-12T16:34:23Z_post_FAKEUNIQUEID.md | ||
TEST_TIME=1992-01-12T17:00:00Z pottery post "Second post." | ||
docs/project-history/1992/1992-01/1992-01-12T17:00:00Z_post_FAKEUNIQUEID.md | ||
TEST_TIME=1992-01-13T16:34:23Z pottery post "It's a new day." | ||
docs/project-history/1992/1992-01/1992-01-13T16:34:23Z_post_FAKEUNIQUEID.md | ||
pottery show | ||
1992-01-13T16:34:23Z | ||
|
||
It's a new day. | ||
|
||
1992-01-12T17:00:00Z | ||
|
||
Second post. | ||
|
||
1992-01-12T16:34:23Z | ||
|
||
First post | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pottery init | ||
TEST_TIME=1992-01-12T16:34:23Z pottery post "First post" | ||
TEST_TIME=1992-01-12T17:00:00Z pottery post "Second post." | ||
TEST_TIME=1992-01-13T16:34:23Z pottery post "It's a new day." | ||
pottery show |