diff options
| author | ewy <ewy0@protonmail.com> | 2026-05-02 17:24:49 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-05-02 17:24:49 +0200 |
| commit | 35e6ac334f6a62cf63b743182cd5355f6baf4406 (patch) | |
| tree | d9ef2fffaf76a6b4a4dc0c064c7efff4bcb1a057 | |
| parent | 65d273d0da5c1a742425e899f053bbee0fef0600 (diff) | |
change flow to only have 1 run() call
| -rw-r--r-- | main.go | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -130,26 +130,30 @@ func main() { args := pflag.Args() + var result *search.Result + if len(args) == 0 { source, target, err := menu.Show(st, hydrators) if err != nil { _, _ = spool.Warn("%v\n", err) os.Exit(1) } - if target == nil { - _, _ = spool.Warn("no target selected.\n") - os.Exit(0) - } - err = run.Run(source.Source, target.Target(), args...) - if err != nil { - _, _ = spool.Warn("%v\n", err) - os.Exit(1) + if target != nil { + t := target.Target() + result = &search.Result{ + Target: t, + Source: source.Source, + NeedsConfirmation: false, + Overridden: t.Tags().Has(model.Override), + Sub: t.Sub(), + } } + } - return + if result == nil { + result = search.Search(st, args...) } - result := search.Search(st, args...) // TODO: Move auto-all logic into Search? if !*flags.All && result.Target == nil && len(result.Args) > 0 && SourcesWithoutResults == nil && !ForceConfirm { ForceConfirm = true |
