@@ -12,6 +12,7 @@ import (
1212 "github.com/jahvon/tuikit/io"
1313 "github.com/jahvon/tuikit/themes"
1414 "github.com/pkg/errors"
15+ "golang.org/x/exp/slices"
1516
1617 "github.com/jahvon/flow/internal/cache"
1718 "github.com/jahvon/flow/internal/filesystem"
@@ -73,21 +74,25 @@ func NewContext(ctx context.Context, stdIn, stdOut *os.File) *Context {
7374
7475 ctxx , cancel := context .WithCancel (ctx )
7576 logMode := cfg .DefaultLogMode
77+ loggerOpts := []io.LoggerOptions {
78+ io .WithOutput (stdOut ),
79+ io .WithTheme (flowIO .Theme (cfg .Theme .String ())),
80+ io .WithMode (logMode ),
81+ }
82+ // only create a log archive file for exec commands
83+ if args := os .Args ; len (args ) > 0 && slices .Contains (executable .ValidVerbs (), executable .Verb (args [0 ])) {
84+ loggerOpts = append (loggerOpts , io .WithArchiveDirectory (filesystem .LogsDir ()))
85+ }
7686 c := & Context {
7787 Ctx : ctxx ,
7888 CancelFunc : cancel ,
7989 Config : cfg ,
8090 CurrentWorkspace : wsConfig ,
8191 WorkspacesCache : workspaceCache ,
8292 ExecutableCache : executableCache ,
83- Logger : io .NewLogger (
84- io .WithOutput (stdOut ),
85- io .WithTheme (flowIO .Theme (cfg .Theme .String ())),
86- io .WithMode (logMode ),
87- io .WithArchiveDirectory (filesystem .LogsDir ()),
88- ),
89- stdOut : stdOut ,
90- stdIn : stdIn ,
93+ Logger : io .NewLogger (loggerOpts ... ),
94+ stdOut : stdOut ,
95+ stdIn : stdIn ,
9196 }
9297
9398 app := tuikit .NewApplication (
0 commit comments