From 7e25e46a37d39ba546889c7e5056257ba2364c2e Mon Sep 17 00:00:00 2001 From: Scrotadamus Date: Fri, 7 Mar 2025 10:28:30 +0100 Subject: 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 --- cmd/root.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'cmd/root.go') 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") } -- cgit v1.2.3