Skip to content

Commit

Permalink
Merge pull request #27 from lxcode/main
Browse files Browse the repository at this point in the history
Write bgs to config on login
  • Loading branch information
mattn authored May 3, 2024
2 parents 2ee510f + a3c9011 commit 4565656
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"
Expand Down Expand Up @@ -464,6 +463,7 @@ func doLogin(cCtx *cli.Context) error {
fp, _ := cCtx.App.Metadata["path"].(string)
var cfg config
cfg.Host = cCtx.String("host")
cfg.Bgs = cCtx.String("bgs")
cfg.Handle = cCtx.Args().Get(0)
cfg.Password = cCtx.Args().Get(1)
if cfg.Handle == "" || cfg.Password == "" {
Expand All @@ -473,7 +473,7 @@ func doLogin(cCtx *cli.Context) error {
if err != nil {
return fmt.Errorf("cannot make config file: %w", err)
}
err = ioutil.WriteFile(fp, b, 0644)
err = os.WriteFile(fp, b, 0644)
if err != nil {
return fmt.Errorf("cannot write config file: %w", err)
}
Expand Down

0 comments on commit 4565656

Please sign in to comment.