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

@ -44,11 +44,14 @@ func init() {
func toggleFeature(cmd *cobra.Command, feature string, enable bool) { func toggleFeature(cmd *cobra.Command, feature string, enable bool) {
env := &runtime.Terminal{ env := &runtime.Terminal{
CmdFlags: &runtime.Flags{ CmdFlags: &runtime.Flags{
Shell: shellName, Shell: shellName,
SaveCache: true,
}, },
} }
env.Init() env.Init()
defer env.Close() defer env.Close()
switch feature { switch feature {
case "notice": case "notice":
if enable { 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] fontName = args[1]
} }
env := &runtime.Terminal{} env := &runtime.Terminal{
CmdFlags: &runtime.Flags{
SaveCache: true,
},
}
env.Init() env.Init()
defer env.Close() defer env.Close()

View file

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

View file

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

View file

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