Split ws from jobsearch as a separate test utility rather than a feature of jobsearch

This commit is contained in:
bwilliams committed 2026-10-16 08:58:25 +01:00
1 parent b714ee14d5
commit 5e61c11eb9
9 files changed
+148 -38

No files matched your search

+7 -20
View File
@@ -1,30 +1,17 @@
// Package ws holds the "ws" command: "ws serve" runs the plain TCP server for
// websocket hub clients, and "ws dial" tests the HTTP server's /ws endpoint.
// Package ws holds the ws-test commands: "serve" runs the plain TCP server
// for websocket hub clients, and "dial" tests the HTTP server's /ws endpoint.
package ws
import (
"log/slog"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli"
)
// NewCommand returns the "ws" command, for the WebSocket servers.
func NewCommand(opts *cli.Options) *cobra.Command {
cmd := &cobra.Command{
Use: "ws",
Short: "WebSocket servers and tools",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
slog.Debug("command persistent pre-run", "command", "ws")
},
PersistentPostRun: func(cmd *cobra.Command, args []string) {
slog.Debug("command persistent post-run", "command", "ws")
},
// NewCommands returns the ws-test commands, "serve" and "dial".
func NewCommands(opts *cli.Options) []*cobra.Command {
return []*cobra.Command{
commandServe(opts),
commandDial(opts),
}
cmd.AddCommand(commandServe(opts))
cmd.AddCommand(commandDial(opts))
return cmd
}