Skip to content
Open
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
10 changes: 9 additions & 1 deletion cmd/carwings/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,21 @@ func main() {
cfg config
username, password string
region, sessionFile string
homeFolder string
)

homeFolder, err := os.UserHomeDir()
if err != nil {
fmt.Fprintf(os.Stderr, "ERROR: could not get user homedir\n")
os.Exit(1)
}
fmt.Fprintf(os.Stderr, "User homedir found: "+homeFolder+"\n")

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind removing this line? I think it's going to be too verbose for normal operation.


fs := flag.NewFlagSet("carwings", flag.ExitOnError)
fs.StringVar(&username, "username", "", "carwings username")
fs.StringVar(&password, "password", "", "carwings password")
fs.StringVar(&region, "region", carwings.RegionUSA, "carwings region. Defaults to US (NNA).")
fs.StringVar(&sessionFile, "session-file", "~/.carwings-session", "carwings session file")
fs.StringVar(&sessionFile, "session-file", homeFolder+"/.carwings-session", "carwings session file")
fs.StringVar(&cfg.units, "units", unitsMiles, "units to use (miles or km). Defaults to miles.")
fs.StringVar(&cfg.effunits, "effunits", unitskWhPerMile, "efficiency units to use (kWh/mile, kWh/km or kWh/100km). Defaults to kWh/mile.")
fs.StringVar(&carwings.BaseURL, "url", carwings.BaseURL, "base carwings api endpoint to use")
Expand Down