From 86905a812e9525fd637791ed40d3ebf73f00fbc3 Mon Sep 17 00:00:00 2001 From: liu-hm19 Date: Thu, 25 Jul 2024 15:27:12 +0800 Subject: [PATCH] feat: support preview all details with flag (#1233) --- pkg/cmd/preview/preview.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/pkg/cmd/preview/preview.go b/pkg/cmd/preview/preview.go index 02a7ef887..72b68f1c4 100644 --- a/pkg/cmd/preview/preview.go +++ b/pkg/cmd/preview/preview.go @@ -295,16 +295,20 @@ func (o *PreviewOptions) Run() error { // detail detection if o.Detail { - for { - var target string - target, err = changes.PromptDetails(o.UI) - if err != nil { - return err + if o.All { + changes.OutputDiff("all") + } else { + for { + var target string + target, err = changes.PromptDetails(o.UI) + if err != nil { + return err + } + if target == "" { // Cancel option + break + } + changes.OutputDiff(target) } - if target == "" { // Cancel option - break - } - changes.OutputDiff(target) } } return nil