add regenerate command
This commit is contained in:
+12
@@ -67,6 +67,18 @@ func main() {
|
|||||||
fmt.Fprintf(os.Stderr, "Error writing feed: %v\n", err)
|
fmt.Fprintf(os.Stderr, "Error writing feed: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
case "regenerate":
|
||||||
|
argCheck(c.Args(), 0, false, "'regenerate' doesn't take an argument!")
|
||||||
|
err = core.Data.WriteSubs(dataPath)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error writing subscriptions: %v\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
err = core.Data.WriteFeed(dataPath)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error writing feed: %v\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
case "add":
|
case "add":
|
||||||
argCheck(c.Args(), 1, true, "Please provide a URL to add.")
|
argCheck(c.Args(), 1, true, "Please provide a URL to add.")
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ variety of feed formats:
|
|||||||
*refresh* [_FLAGS_]
|
*refresh* [_FLAGS_]
|
||||||
Check for new updates to subscriptions and update aggregator page.
|
Check for new updates to subscriptions and update aggregator page.
|
||||||
|
|
||||||
|
*regenerate*
|
||||||
|
Will regenerate all the files created by comitium using cached entries
|
||||||
|
without fetching any feeds.
|
||||||
|
|
||||||
*add* [_FLAGS_] <_LINK_> [_TITLE_]
|
*add* [_FLAGS_] <_LINK_> [_TITLE_]
|
||||||
Add a new subscription. _LINK_ is a link to the feed or watched URL.
|
Add a new subscription. _LINK_ is a link to the feed or watched URL.
|
||||||
_TITLE_ is an optional title for the feed, otherwise a title will be
|
_TITLE_ is an optional title for the feed, otherwise a title will be
|
||||||
@@ -30,6 +34,9 @@ variety of feed formats:
|
|||||||
first heading on a page is used as a title. For ATOM, RSS, and JSON feeds,
|
first heading on a page is used as a title. For ATOM, RSS, and JSON feeds,
|
||||||
the provided title is used. For a page being watched for changes, the URL
|
the provided title is used. For a page being watched for changes, the URL
|
||||||
itself is used.
|
itself is used.
|
||||||
|
Also to note: when adding a new subscription, you *do not* need to run
|
||||||
|
*refresh* afterwards, *add* will automatically fetch the entries and
|
||||||
|
regenerate the .gmi and .json files.
|
||||||
|
|
||||||
*remove* <_LINK_>
|
*remove* <_LINK_>
|
||||||
Remove a subscription at _LINK_.
|
Remove a subscription at _LINK_.
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ type command struct {
|
|||||||
// info about all the accepted commands
|
// info about all the accepted commands
|
||||||
var commandInfo = []command{
|
var commandInfo = []command{
|
||||||
{"refresh", "Check for new updates to subscriptions"},
|
{"refresh", "Check for new updates to subscriptions"},
|
||||||
|
{"regenerate", "Regenerate all files generated by comitium without checking for new updates."},
|
||||||
{"add", "Add a new subscription"},
|
{"add", "Add a new subscription"},
|
||||||
{"remove", "Remove a subscription"},
|
{"remove", "Remove a subscription"},
|
||||||
{"help", "Print usage information"},
|
{"help", "Print usage information"},
|
||||||
@@ -30,6 +31,7 @@ var commandInfo = []command{
|
|||||||
|
|
||||||
var commands = map[string]*flag.FlagSet{
|
var commands = map[string]*flag.FlagSet{
|
||||||
"refresh": flag.NewFlagSet("refresh", flag.ExitOnError),
|
"refresh": flag.NewFlagSet("refresh", flag.ExitOnError),
|
||||||
|
"regenerate": flag.NewFlagSet("regenerate", flag.ExitOnError),
|
||||||
"add": flag.NewFlagSet("add", flag.ExitOnError),
|
"add": flag.NewFlagSet("add", flag.ExitOnError),
|
||||||
"remove": flag.NewFlagSet("remove", flag.ExitOnError),
|
"remove": flag.NewFlagSet("remove", flag.ExitOnError),
|
||||||
}
|
}
|
||||||
@@ -43,6 +45,7 @@ var (
|
|||||||
`Watch a page instead of adding it as a feed.`,
|
`Watch a page instead of adding it as a feed.`,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// refresh
|
||||||
refreshWorkersFlag = commands["refresh"].IntP(
|
refreshWorkersFlag = commands["refresh"].IntP(
|
||||||
"num-workers", "n",
|
"num-workers", "n",
|
||||||
5, // 5 workers is a safe default
|
5, // 5 workers is a safe default
|
||||||
|
|||||||
Reference in New Issue
Block a user