From 8fb49796e37d2bf955d8ffa521f6bcda4f36b766 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sun, 2 Oct 2022 20:46:50 +0530 Subject: Automatically select nth search result with --auto-select flag --- util/bind_config.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'util') diff --git a/util/bind_config.go b/util/bind_config.go index 2ab6cc9..ece5c2e 100644 --- a/util/bind_config.go +++ b/util/bind_config.go @@ -33,6 +33,7 @@ type SearchConfig struct { PromptLength int SearchLength int SearchOffset int + AutoSel int SearchNSFW bool } @@ -49,6 +50,13 @@ func BindSearchConfig(flags *pflag.FlagSet) (SearchConfig, error) { err error ) + if flags.Lookup("auto-select").Changed { + conf.AutoSel, err = flags.GetInt("auto-select") + if err != nil {return conf, err} + } else { + conf.AutoSel = viper.GetInt("searching.auto_select_n") + } + if flags.Lookup("prompt-length").Changed { conf.PromptLength, err = flags.GetInt("prompt-length") if err != nil {return conf, err} -- cgit v1.2.3