diff --git a/README.md b/README.md index 7befef7..90b98f4 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ 2. build: ``` -dub build +dub build -b release ``` You'll find the `cartastraccia` executable in the root project directory. @@ -68,10 +68,26 @@ CLI options and sample first usage: ``` -cartastraccia --help +$ cartastraccia --help + +-d --daemon Start daemon +-e --endpoint Endpoints to register [cli] +-f --feeds File containing feeds to pull [feeds.conf] +-l --host Bind to this address [localhost] +-p --port Bind to this port [8080] +-b --browser Absolute path to browser for HTML rendering [/usr/bin/elinks] +-r --reload Reload feeds file +-h --help This help information. ``` -For feeds configuration, see the sample `feeds.conf` file included. +RSS feeds are gathered from a configuration file specified by the option "--feeds=" +A feed configuration file should have the following format: +``` +Title refresh-time url +``` + +where refresh time can be expressed in seconds `s`, minutes `m`, hours `h` or days `d`. +You can see an example `feeds.conf` file included in the repository. ## License diff --git a/source/cartastraccia/actor.d b/source/cartastraccia/actor.d index 1361c1b..ef909b6 100644 --- a/source/cartastraccia/actor.d +++ b/source/cartastraccia/actor.d @@ -57,15 +57,26 @@ */ alias RSSActorList = SumType!(RSSActor[], InvalidFeeds); +/** + * Used when an error + * in the configuration file is encountered + */ struct InvalidFeeds { string msg; } +/** + * Generated from each line of the configuration file, + * the members describes entries by the user. + */ struct RSSActor { + /// title of the feed string name; + /// refresh rate, seconds/minutes/hours/days Duration refresh; + /// URL to request the rss feed string path; this(string[] props) @safe @@ -197,6 +208,7 @@ */ enum FeedActorRequest { DATA_CLI, DATA_HTML, QUIT } +/// ditto enum FeedActorResponse { INVALID, VALID } alias RequestDataLength = ulong; @@ -207,7 +219,7 @@ /** * Listen for messages from the webserver -*/ + */ void listenOnce(immutable string feedName, ref RSS rss) { bool quit = false; diff --git a/source/cartastraccia/config.d b/source/cartastraccia/config.d index c64e5e0..2279478 100644 --- a/source/cartastraccia/config.d +++ b/source/cartastraccia/config.d @@ -63,7 +63,10 @@ Newline <- endOfLine / endOfInput `; - +/** + * Populate a list of structures + * containing data parsed from feed.conf + */ RSSActorList loadFeedsConfig(immutable string feedsFile) {