File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed
Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 11# CHANGELOG
22
3+ ## [ 0.8.1]
4+
5+ * Print error/usage when passed positional arguments
6+
37## [ 0.8]
48
59* Initial release
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ package main
55import (
66 "context"
77 "flag"
8+ "fmt"
89 "io"
910 "log"
1011 "os"
@@ -28,6 +29,11 @@ const authSockEnv = "SSH_AUTH_SOCK"
2829
2930func main () {
3031 flag .Parse ()
32+ if len (flag .Args ()) != 0 {
33+ fmt .Fprintln (flag .CommandLine .Output (), "Error: No positional arguments allowed." )
34+ flag .Usage ()
35+ os .Exit (2 )
36+ }
3137
3238 ctx := context .Background ()
3339 for {
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package main
22
33import (
44 "flag"
5+ "fmt"
56 "io"
67 "log"
78 "net"
@@ -19,6 +20,11 @@ const authSockEnv = "SSH_AUTH_SOCK"
1920
2021func main () {
2122 flag .Parse ()
23+ if len (flag .Args ()) != 0 {
24+ fmt .Fprintln (flag .CommandLine .Output (), "Error: No positional arguments allowed." )
25+ flag .Usage ()
26+ os .Exit (2 )
27+ }
2228
2329 path := os .Getenv (authSockEnv )
2430 if len (path ) == 0 {
You can’t perform that action at this time.
0 commit comments