summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go24
1 files changed, 14 insertions, 10 deletions
diff --git a/main.go b/main.go
index 18ef298..4e94ee0 100644
--- a/main.go
+++ b/main.go
@@ -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