Skip to content

Commit

Permalink
clean: add --filter flag to allow override of configured client filter
Browse files Browse the repository at this point in the history
  • Loading branch information
l3uddz committed Apr 20, 2021
1 parent 1dd9fa3 commit 7951a61
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
9 changes: 9 additions & 0 deletions cmd/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ var cleanCmd = &cobra.Command{
log.WithError(err).Fatal("Failed retrieving client filter")
}

if flagFilterName != "" {
clientFilter, err = getFilter(flagFilterName)
if err != nil {
log.WithError(err).Fatal("Failed retrieving specified filter")
}
}

// compile client filters
exp, err := expression.Compile(clientFilter)
if err != nil {
Expand Down Expand Up @@ -115,4 +122,6 @@ var cleanCmd = &cobra.Command{

func init() {
rootCmd.AddCommand(cleanCmd)

cleanCmd.Flags().StringVar(&flagFilterName, "filter", "", "Filter to use instead of client")
}
4 changes: 0 additions & 4 deletions cmd/relabel.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ import (
"github.com/spf13/cobra"
)

var (
flagFilterName string
)

var relabelCmd = &cobra.Command{
Use: "relabel [CLIENT]",
Short: "Check torrent client for torrents to relabel",
Expand Down
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var (
flagConfigFolder = config.GetDefaultConfigDirectory("tqm", flagConfigFile)
flagLogFile = "activity.log"

flagFilterName string
flagDryRun bool

// Global vars
Expand Down

0 comments on commit 7951a61

Please sign in to comment.