Skip to content

fix wsh output. all output is run through sprintf, so escape properly #971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/wsh/cmd/wshcmd-getmeta.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ func getMetaRun(cmd *cobra.Command, args []string) {
return
}
outStr := string(outBArr)
WriteStdout(outStr + "\n")
WriteStdout("%s\n", outStr)
} else {
outBArr, err := json.MarshalIndent(resp, "", " ")
if err != nil {
WriteStderr("[error] formatting metadata: %v\n", err)
return
}
outStr := string(outBArr)
WriteStdout(outStr + "\n")
WriteStdout("%s\n", outStr)
}
}
2 changes: 1 addition & 1 deletion cmd/wsh/cmd/wshcmd-readfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ func runReadFile(cmd *cobra.Command, args []string) {
WriteStderr("[error] decoding file: %v\n", err)
return
}
WriteStdout(string(resp))
WriteStdout("%s", string(resp))
}
2 changes: 1 addition & 1 deletion cmd/wsh/cmd/wshcmd-shell-unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var shellCmd = &cobra.Command{
Hidden: true,
Short: "Print the login shell of this user",
Run: func(cmd *cobra.Command, args []string) {
WriteStdout(shellCmdInner())
WriteStdout("%s", shellCmdInner())
},
}

Expand Down
4 changes: 1 addition & 3 deletions cmd/wsh/cmd/wshcmd-version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
package cmd

import (
"fmt"

"github.com/spf13/cobra"
"github.com/wavetermdev/waveterm/pkg/wavebase"
)
Expand All @@ -18,6 +16,6 @@ var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of wsh",
Run: func(cmd *cobra.Command, args []string) {
WriteStdout(fmt.Sprintf("wsh v%s\n", wavebase.WaveVersion))
WriteStdout("wsh v%s\n", wavebase.WaveVersion)
},
}
8 changes: 8 additions & 0 deletions pkg/wconfig/defaultconfig/presets.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,13 @@
"bg": "linear-gradient(135deg, rgba(204, 51, 255, 0.9) 0%, rgba(255, 85, 153, 0.75) 30%, rgba(255, 51, 153, 0.65) 60%, rgba(204, 51, 255, 0.6) 80%, rgba(51, 102, 255, 0.5) 100%), radial-gradient(circle at 30% 40%, rgba(255,255,255,0.1), transparent 60%), radial-gradient(circle at 70% 70%, rgba(255,255,255,0.05), transparent 70%)",
"bg:opacity": 0.9,
"bg:blendmode": "overlay"
},
"bg@twilight-ember": {
"display:name": "Twilight Ember",
"display:order": 3.5,
"bg:*": true,
"bg": "linear-gradient(120deg,hsla(350, 65%, 57%, 1),hsla(30,60%,60%, .75), hsla(208,69%,50%,.15), hsl(230,60%,40%)),radial-gradient(at top right,hsla(300,60%,70%,0.3),transparent),radial-gradient(at top left,hsla(330,100%,70%,.20),transparent),radial-gradient(at top right,hsla(190,100%,40%,.20),transparent),radial-gradient(at bottom left,hsla(323,54%,50%,.5),transparent),radial-gradient(at bottom left,hsla(144,54%,50%,.25),transparent)",
"bg:blendmode": "overlay",
"bg:text": "rgb(200, 200, 200)"
}
}