diff --git a/cmd/mstdn/main.go b/cmd/mstdn/main.go index da9db94..b9fcbf0 100644 --- a/cmd/mstdn/main.go +++ b/cmd/mstdn/main.go @@ -172,7 +172,7 @@ func makeApp() *cli.App { app.Version = "0.0.1" app.Flags = []cli.Flag{ cli.StringFlag{ - Name: "a", + Name: "profile", Usage: "profile name", Value: "", }, diff --git a/cmd/mstdn/main_test.go b/cmd/mstdn/main_test.go index f4fdf04..258cd79 100644 --- a/cmd/mstdn/main_test.go +++ b/cmd/mstdn/main_test.go @@ -2,10 +2,13 @@ package main import ( "encoding/json" + "flag" "io/ioutil" "log" "os" "testing" + + "github.com/urfave/cli" ) func TestReadFileFile(t *testing.T) { @@ -72,7 +75,11 @@ func TestGetConfig(t *testing.T) { os.Setenv("APPDATA", appdata) }() - file, config, err := getConfig() + app := makeApp() + set := flag.NewFlagSet("test", 0) + set.Parse([]string{"mstdn", "-profile", ""}) + c := cli.NewContext(app, set, nil) + file, config, err := getConfig(c) if err != nil { t.Fatal(err) } @@ -97,7 +104,7 @@ func TestGetConfig(t *testing.T) { if err != nil { log.Fatal(err) } - file, config, err = getConfig() + file, config, err = getConfig(c) if err != nil { t.Fatal(err) }