Add flags to remove for more fine-grained removals
This commit is contained in:
+5
-5
@@ -104,12 +104,11 @@ func main() {
|
||||
}
|
||||
case "remove":
|
||||
argCheck(c.Args(), 1, true, "Please provide a URL to remove.")
|
||||
if (!*removeFeedsFlag && !*removePagesFlag) || *removeFeedsFlag {
|
||||
delete(core.Data.Feeds, c.Arg(0))
|
||||
}
|
||||
if (!*removeFeedsFlag && !*removePagesFlag) || *removePagesFlag {
|
||||
delete(core.Data.Pages, c.Arg(0))
|
||||
err = core.Data.WriteSubs(dataPath)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error saving subscriptions: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +181,8 @@ func usage() {
|
||||
fmt.Fprintf(os.Stderr, "\nGlobal Flags:\n%v", globalFs.FlagUsages())
|
||||
// command-specific flags should be printed here
|
||||
fmt.Fprintf(os.Stderr, "Flags for \"add\":\n%v", commands["add"].FlagUsages())
|
||||
fmt.Fprintf(os.Stderr, "Flags for \"refresh\":\n%v\n", commands["refresh"].FlagUsages())
|
||||
fmt.Fprintf(os.Stderr, "Flags for \"refresh\":\n%v", commands["refresh"].FlagUsages())
|
||||
fmt.Fprintf(os.Stderr, "Flags for \"remove\":\n%v\n", commands["remove"].FlagUsages())
|
||||
|
||||
fmt.Fprint(os.Stderr, "For more help, see comitium(1).\n")
|
||||
}
|
||||
|
||||
+11
-2
@@ -38,8 +38,9 @@ variety of feed formats:
|
||||
*refresh* afterwards, *add* will automatically fetch the entries and
|
||||
regenerate the .gmi and .json files.
|
||||
|
||||
*remove* <_LINK_>
|
||||
Remove a subscription at _LINK_.
|
||||
*remove* [_FLAGS_] <_LINK_>
|
||||
Remove a subscription at _LINK_. Will remove from both subscribed feeds and
|
||||
subscribed pages by default.
|
||||
|
||||
*help*
|
||||
Print basic usage information, including a list of commands and flags with
|
||||
@@ -73,6 +74,14 @@ command-specific flags that are not universally recognized.
|
||||
Watch a page for changes instead of adding as a feed. Useful for gophermaps,
|
||||
or gemini/http resources with no parseable feed.
|
||||
|
||||
## REMOVE FLAGS
|
||||
|
||||
*-f*, *--feeds*
|
||||
Remove the URL from subscribed feeds.
|
||||
|
||||
*-p*, *--pages*
|
||||
Remove the URL from subscribed pages.
|
||||
|
||||
# ENVIRONMENT VARIABLES
|
||||
|
||||
*COMITIUM_DATA*
|
||||
|
||||
@@ -52,4 +52,16 @@ var (
|
||||
`Number of worker threads to use when refreshing feeds. More is faster,
|
||||
but there are more concurrent outgoing requests then.`,
|
||||
)
|
||||
|
||||
// remove
|
||||
removeFeedsFlag = commands["remove"].BoolP(
|
||||
"feeds", "f",
|
||||
false,
|
||||
`Remove URL from subscribed feeds.`,
|
||||
)
|
||||
removePagesFlag = commands["remove"].BoolP(
|
||||
"pages", "p",
|
||||
false,
|
||||
`remove URL from subscribed pages.`,
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user