diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.xyz> | 2022-10-02 20:46:50 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.xyz> | 2022-10-02 20:46:50 +0530 |
commit | 8fb49796e37d2bf955d8ffa521f6bcda4f36b766 (patch) | |
tree | e0728f19a33c2f8f71767472c10767548ce99e94 /util/bind_config.go | |
parent | e0da6a5205169f34671addd533739b6242d5eff3 (diff) |
Automatically select nth search result with --auto-select flag
Diffstat (limited to 'util/bind_config.go')
-rw-r--r-- | util/bind_config.go | 8 |
1 files changed, 8 insertions, 0 deletions
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} |