Skip to content

Commit

Permalink
Fix username lookup and flag evaluation
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Lamp <[email protected]>
  • Loading branch information
modzilla99 committed Jul 24, 2024
1 parent d173ddb commit 9b8b175
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/general/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func ParseArgs() (args generic.Args) {
// args := generic.Args{}
// Set username, default to the current username of the shell session
username, gotUsernameFromEnv := os.LookupEnv("USERNAME")
username, _ := os.LookupEnv("USER")
flag.StringVar(&args.Username, "u", username, "sets username to connect to HV with")

flag.IntVar(&args.Port, "p", 2222, "Port for SSH to locally listen on")
Expand All @@ -25,7 +25,7 @@ func ParseArgs() (args generic.Args) {
flag.Parse()
parsedArgs := flag.Args()

if !gotUsernameFromEnv && username == "" {
if args.Username == "" {
fmt.Println("Cannot get username from environment, please specify username with -u")
os.Exit(1)
}
Expand Down

0 comments on commit 9b8b175

Please sign in to comment.