fix(cache): write on CLI commands
Some checks are pending
Code QL / code-ql (push) Waiting to run
Release / changelog (push) Waiting to run
Release / artifacts (push) Blocked by required conditions

This commit is contained in:
Jan De Dobbeleer 2024-09-19 16:28:50 +02:00 committed by Jan De Dobbeleer
parent 3114666a25
commit 6c13aaf0ef
5 changed files with 22 additions and 4 deletions

View file

@ -45,10 +45,13 @@ func toggleFeature(cmd *cobra.Command, feature string, enable bool) {
env := &runtime.Terminal{
CmdFlags: &runtime.Flags{
Shell: shellName,
SaveCache: true,
},
}
env.Init()
defer env.Close()
switch feature {
case "notice":
if enable {

View file

@ -36,7 +36,12 @@ This command is used to install fonts and configure the font in your terminal.
fontName = args[1]
}
env := &runtime.Terminal{}
env := &runtime.Terminal{
CmdFlags: &runtime.Flags{
SaveCache: true,
},
}
env.Init()
defer env.Close()

View file

@ -16,8 +16,11 @@ var noticeCmd = &cobra.Command{
Args: cobra.NoArgs,
Run: func(_ *cobra.Command, _ []string) {
env := &runtime.Terminal{
CmdFlags: &runtime.Flags{},
CmdFlags: &runtime.Flags{
SaveCache: true,
},
}
env.Init()
defer env.Close()

View file

@ -19,7 +19,13 @@ var toggleCmd = &cobra.Command{
_ = cmd.Help()
return
}
env := &runtime.Terminal{}
env := &runtime.Terminal{
CmdFlags: &runtime.Flags{
SaveCache: true,
},
}
env.Init()
defer env.Close()

View file

@ -47,6 +47,7 @@ func Latest(env runtime.Environment) (string, error) {
if err != nil {
return "", err
}
var release release
// this can't fail
_ = json.Unmarshal(body, &release)