Skip to content

chore: improve consistency of help output #61

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 1 commit into from
Oct 14, 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
6 changes: 3 additions & 3 deletions cmd/wush/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ func cpCmd() *serpent.Command {
)
return &serpent.Command{
Use: "cp <file>",
Short: "Transfer files.",
Long: "Transfer files to a " + cliui.Code("wush") + " peer.\n" + formatExamples(
Short: "Transfer files to a wush server.",
Long: formatExamples(
example{
Description: "Copy a local file to the remote",
Description: "Copy a local file to the server",
Command: "wush cp local-file.txt",
},
),
Expand Down
10 changes: 5 additions & 5 deletions cmd/wush/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@ func main() {
var (
showVersion bool

fmtLong = "wush %s - peer-to-peer file transfers and shells\n"
fmtLong = "wush %s - WireGuard-powered peer-to-peer file transfer and shell\n"
)
cmd := &serpent.Command{
Use: "wush <subcommand>",
Long: fmt.Sprintf(fmtLong, getBuildInfo().version) + formatExamples(
example{
Description: "Start the wush server",
Description: "Start the wush server to accept incoming connections",
Command: "wush serve",
},
example{
Description: "Open a shell to the wush host",
Description: "Open a shell to a wush server",
Command: "wush ssh",
},
example{
Description: "Transfer files to the wush host using rsync",
Description: "Transfer files to a wush server with rsync",
Command: "wush rsync local-file.txt :/path/to/remote/file",
},
example{
Description: "Copy a single file to the host",
Description: "Copy a single file to a wush server",
Command: "wush cp local-file.txt",
},
),
Expand Down
14 changes: 7 additions & 7 deletions cmd/wush/portforward.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,26 @@ func portForwardCmd() *serpent.Command {
)
return &serpent.Command{
Use: "port-forward",
Short: "Forward TCP or UDP ports",
Long: "Redirect data between local ports and ports on the remote " + cliui.Code("wush") + " peer.\n" + formatExamples(
Short: "Forward ports from the wush server.",
Long: formatExamples(
example{
Description: "Port forward a single TCP port from 1234 in the peer to port 5678 on your local machine",
Description: "Forward a single TCP port from 1234 on the server to port 5678 on your local machine",
Command: "wush port-forward --tcp 5678:1234",
},
example{
Description: "Port forward a single UDP port from port 9000 to port 9000 on your local machine",
Description: "Forward a single UDP port",
Command: "wush port-forward --udp 9000",
},
example{
Description: "Port forward multiple TCP ports and a UDP port",
Description: "Forward multiple TCP ports and a UDP port",
Command: "wush port-forward --tcp 8080:8080 --tcp 9000:3000 --udp 5353:53",
},
example{
Description: "Port forward multiple ports (TCP or UDP) in condensed syntax",
Description: "Forward multiple ports (TCP or UDP) in condensed syntax",
Command: "wush port-forward --tcp 8080,9000:3000,9090-9092,10000-10002:10010-10012",
},
example{
Description: "Port forward specifying the local address to bind to",
Description: "Forward specifying the local address to bind",
Command: "wush port-forward --tcp 1.2.3.4:8080:8080",
},
),
Expand Down
9 changes: 4 additions & 5 deletions cmd/wush/rsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,16 @@ func rsyncCmd() *serpent.Command {
)
return &serpent.Command{
Use: "rsync [flags] -- [rsync args]",
Short: "Transfer files over rsync.",
Long: "Runs rsync to transfer files to a " + cliui.Code("wush") + " peer. " +
"Use " + cliui.Code("wush serve") + " on the computer you would like to connect to." +
Short: "Transfer files with rsync to/from a wush server.",
Long: "Use " + cliui.Code("wush serve") + " on the computer you would like to transfer files to." +
"\n\n" +
formatExamples(
example{
Description: "Sync a local file to the remote",
Description: "Upload a local file",
Command: "wush rsync /local/path :/remote/path",
},
example{
Description: "Download a remote file to the local computer",
Description: "Download a remote file",
Command: "wush rsync :/remote/path /local/path",
},
example{
Expand Down
6 changes: 2 additions & 4 deletions cmd/wush/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ func serveCmd() *serpent.Command {
dm = new(tailcfg.DERPMap)
)
return &serpent.Command{
Use: "serve",
Aliases: []string{"host"},
Short: "Run the wush server.",
Long: "Runs the wush server. Allows other wush CLIs to connect to this computer.",
Use: "serve",
Short: "Run the wush server. Allow wush clients to connect.",
Middleware: serpent.Chain(
derpMap(&derpmapFi, dm),
),
Expand Down
5 changes: 2 additions & 3 deletions cmd/wush/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ func sshCmd() *serpent.Command {
return &serpent.Command{
Use: "ssh",
Aliases: []string{},
Short: "Open a shell.",
Long: "Opens an SSH connection to a " + cliui.Code("wush") + " peer. " +
"Use " + cliui.Code("wush serve") + " on the computer you would like to connect to.",
Short: "Open a SSH connection to a wush server.",
Long: "Use " + cliui.Code("wush serve") + " on the computer you would like to connect to.",
Middleware: serpent.Chain(
initLogger(&verbose, &quiet, logger, &logf),
initAuth(&overlayOpts.authKey, &overlayOpts.clientAuth),
Expand Down
2 changes: 1 addition & 1 deletion cmd/wush/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
func versionCmd() *serpent.Command {
cmd := &serpent.Command{
Use: "version",
Short: "Show wush version.",
Short: "Output the wush version.",
Handler: func(inv *serpent.Invocation) error {
bi := getBuildInfo()
fmt.Printf("Wush %s-%s %s\n", bi.version, bi.commitHash[:7], bi.commitTime.Format(time.RFC1123))
Expand Down