add readme

This commit is contained in:
filifa 2024-06-20 22:02:43 -05:00
parent 1279a879c3
commit 3cfffb5c8f
1 changed files with 47 additions and 0 deletions

47
README.md Normal file
View File

@ -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 <feeds> -o <format>
```
where `<feeds>` is a list of one or more RSS feeds, and `<format>` 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.*