Implemented a global option to suppress logs by ids

You can now use -suppress LOGID or -s LOGID to not print logs with the given
ids.  This is a global option which means it is applicable to all commands.
It can be specified more than once.
This commit is contained in:
Gilbert Chen
2020-04-07 23:22:17 -04:00
parent 0a51bd8d1a
commit 749db78a1f
2 changed files with 22 additions and 0 deletions

View File

@@ -159,6 +159,10 @@ func setGlobalOptions(context *cli.Context) {
}()
}
for _, logID := range context.GlobalStringSlice("suppress") {
duplicacy.SuppressLog(logID)
}
duplicacy.RunInBackground = context.GlobalBool("background")
}
@@ -2069,6 +2073,11 @@ func main() {
Name: "comment",
Usage: "add a comment to identify the process",
},
cli.StringSliceFlag{
Name: "suppress, s",
Usage: "suppress logs with the specified id",
Argument: "<id>",
},
}
app.HideVersion = true