summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md49
1 files changed, 33 insertions, 16 deletions
diff --git a/README.md b/README.md
index 4b7cb99..1079751 100644
--- a/README.md
+++ b/README.md
@@ -5,8 +5,8 @@
configuration file and outputs the relevant selectors to be added to a
gophermap. The list of selectors of updated phlogs is sorted in
decreasing order of update time (meaning that more recent updates appear
-at the top of the list). `phrollo` also outputs an updaterd config file,
-to be used for future calls.
+at the top of the list). `phrollo` also prints on stderr an updaterd
+config file, to be used for future calls.
`phrollo` detects updates by using `shasum -a 256`, i.e. by computing
a hash of the resource and comparing it with the hash obtained when the
@@ -15,25 +15,23 @@ resource was last seen.
Usage
===========
-1)
+Either :
```
./phrollo status.txt
```
-
-In this case, `phrollo` will put a new config file in `status.txt.new`,
-and output the sorted list of gopher selectors. The config file received
-on input will also be saved in `status.txt.bak`.
-2)
+or:
```
- cat config.txt | ./phrollo
+ cat status.txt | ./phrollo
```
-In this case, the new config file will be put in `phrollo.out`, and
-output the sorted list of gopher selectors.
+will print the sorted list of gopher selectors on stdout, and the
+updated config file on stderr.
IMPORTANT: The next time `phrollo` is run, it must be given the last
-config file generated.
+config file generated, so be sure to redirect stderr appropriately. A
+fully working example is given below.
+
Configuration file
========================
@@ -71,7 +69,13 @@ them with a "-" dash. Notice that fields are separated by actual TABs:
- KatolaZ /~katolaz/phlog republic.circumlunar.space 70 -
```
-Now we can feed this file to `phrollo` to get:
+Now we can feed this file to `phrollo`:
+
+```
+cat config.txt | ./phrollo 2> config_updated.txt > gophermap
+```
+
+and we will get the following output in `gophermap`:
```
1(20190126) Alex Shroeder / alexschroeder.ch 70
@@ -83,8 +87,7 @@ Now we can feed this file to `phrollo` to get:
```
which is a list of selectors corresponding to the phlogs specified in
-the config file. Moreover, `phrollo` will also create the updated
-config file `phrollo.out`:
+the config file, and the updated config file in config_updated.txt:
```
20190126 Tomasino /phlog gopher.black 70 bd141abfc29522e3e2b5d00f1a656212201ae5def60de90a7ce847cddeb6d0db
@@ -96,4 +99,18 @@ config file `phrollo.out`:
```
Then, we can run `phrollo` again using the latest updated config file
-(i.e., `phrollo.out`) to detect updates.
+to detect updates and generate the new gophermap. It is possible to
+automate the update procedure by something like:
+
+```
+#!/bin/sh
+
+cp config.txt config.txt."$(date +%Y%m%d)"
+cat config.txt | ./phrollo 2> config.txt.new > gophermap.new
+
+[ $? -eq 0 ] && {
+ mv config.txt.new config.txt
+ mv gophermap.new gophermap
+}
+
+```