ability to load variable from file

This commit is contained in:
Brad Rydzewski
2017-03-31 16:24:15 +09:00
committed by Jacob McCann
parent 7f4b273a05
commit 21fcab0dee
5 changed files with 166 additions and 188 deletions

View File

@@ -1290,3 +1290,23 @@ func TestParseGenericFromEnvCascade(t *testing.T) {
}
a.Run([]string{"run"})
}
// func TestFlagFromFile(t *testing.T) {
// temp, err := ioutil.TempFile("", "urfave_cli_test")
// if err != nil {
// t.Error(err)
// return
// }
// io.WriteString(temp, "abc")
// temp.Close()
// defer func() {
// os.Remove(temp.Name())
// }()
//
// if want, got := flagFromFileEnv("file-does-not-exist", "123"), "123"; want != got {
// t.Errorf("Did not expect %v - Got %v", want, got)
// }
// if want, got := flagFromFile(temp.Name(), "123"), "abc"; want != got {
// t.Errorf("Did not expect %v - Got %v", want, got)
// }
// }