summaryrefslogtreecommitdiff
path: root/cmd/root.go
diff options
context:
space:
mode:
authorScrotadamus <scrotadamus@insiberia.net>2025-03-07 10:28:30 +0100
committerScrotadamus <scrotadamus@insiberia.net>2025-03-07 10:28:30 +0100
commit7e25e46a37d39ba546889c7e5056257ba2364c2e (patch)
tree89a541a4a8fd88d6c4858c099f1593b7e33c6215 /cmd/root.go
parenteb5f9e3485f47bcd1b527b4bd5c7864acea04096 (diff)
disable poppler warnings by default
user can enable poppler warnings by doing using the `--warnigs` flag Changes to be committed: modified: root.go modified: ../go-poppler/utils.go
Diffstat (limited to 'cmd/root.go')
-rw-r--r--cmd/root.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/cmd/root.go b/cmd/root.go
index 321253c..e93a4e7 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -7,14 +7,26 @@ import (
"os"
"github.com/scrotadamus/ghligh/cmd/tag"
+ "github.com/scrotadamus/ghligh/go-poppler"
"github.com/spf13/cobra"
)
+var warnings bool
+
var rootCmd = &cobra.Command{
Use: "ghligh",
Short: "pdf highlights swiss knife",
Long: `ghligh can be used to manipulate pdf files in various ways.`,
+ PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
+
+ if !warnings {
+ poppler.DisablePopplerWarnings()
+ }
+
+ return nil
+ },
+
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
return
@@ -33,4 +45,5 @@ func Execute() {
func init() {
//rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
rootCmd.AddCommand(tag.TagCmd)
+ rootCmd.PersistentFlags().BoolVar(&warnings, "warnings", false, "show poppler warnings")
}