diff --git a/references/cli/logs.go b/references/cli/logs.go index 1fd5d23ba..ba0c17634 100644 --- a/references/cli/logs.go +++ b/references/cli/logs.go @@ -19,6 +19,7 @@ package cli import ( "context" "fmt" + "regexp" "strings" "github.com/fatih/color" @@ -34,6 +35,8 @@ import ( "github.com/oam-dev/kubevela/references/appfile" ) +var re = regexp.MustCompile(`^.*?"([^"]*)"`) + // NewLogsCommand creates `logs` command to tail logs of application func NewLogsCommand(c common.Args, order string, ioStreams util.IOStreams) *cobra.Command { largs := &Args{Args: c} @@ -122,6 +125,10 @@ func (l *Args) printPodLogs(ctx context.Context, ioStreams util.IOStreams, selec } } if show { + match := re.FindStringSubmatch(str) + if len(match) > 1 { + str = strings.ReplaceAll(match[1], "\\n", "\n") + } ioStreams.Infonln(str) } case <-ctx.Done(): diff --git a/references/cli/workflow.go b/references/cli/workflow.go index 8d1880fa2..2619d4891 100644 --- a/references/cli/workflow.go +++ b/references/cli/workflow.go @@ -454,7 +454,7 @@ func (w *WorkflowArgs) selectWorkflowStep(msg string) error { if err != nil { return fmt.Errorf("failed to select step %s: %w", unwrapStepName(w.StepName), err) } - w.StepName = unwrapStepID(stepName, w.WorkflowInstance) + w.StepName = unwrapStepName(stepName) return nil }