diff --git a/README.md b/README.md new file mode 100644 index 0000000..6cbfc85 --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +# rssfetch +rssfetch outputs items contained in RSS feeds. You can specify the output +format with the `-o` flag. For instance, `-o "{{.Title}}"` will only output the +title of each item. + +## Usage +Run rssfetch with +``` +rssfetch -o +``` +where `` is a list of one or more RSS feeds, and `` is a format +string. + +### Output formatting +By default, rssfetch will output the title, description, and link of each RSS +item. To change the output format, use the `-o` flag. The string uses the +syntax of Go's [text/template](https://pkg.go.dev/text/template) package. + +For available fields, see the Item struct of +[gofeed](https://pkg.go.dev/github.com/mmcdole/gofeed). This includes, but is +not limited to: +* `.Title` +* `.Description` +* `.Content` +* `.Link` +* `.Updated` +* `.Published` + +As an example, running the program as +``` +rssfetch https://lorem-rss.herokuapp.com/feed -o $'{{.Title}}\n\n\n{{.Link}}\n{{.Published}}\n' +``` +would output items like the following: +``` +Lorem ipsum 2024-04-26T03:33:34Z + + +http://example.com/test/1714102414 +Fri, 26 Apr 2024 03:33:34 GMT +``` +(i.e. the title followed by three new lines, then the link followed by a new +line, then the publication date followed by a new line.) + +*Note that $'string' is a [bash +feature](https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html) +to replace escaped characters like \n, and is not POSIX standard. Other shells +might need different tricks to use escaped characters.*