When passed a directory as cli-arg, find a README[.md] in it

This commit is contained in:
Christian Muehlhaeuser 2019-12-06 18:44:58 +01:00
parent 37c9cfad80
commit 95670866e0

View file

@ -73,9 +73,10 @@ func readerFromArg(s string) (*Source, error) {
}
}
if len(s) == 0 {
st, _ := os.Stat(s)
if len(s) == 0 || st.IsDir() {
for _, v := range readmeNames {
r, err := os.Open(v)
r, err := os.Open(filepath.Join(s, v))
if err == nil {
u, _ := filepath.Abs(v)
return &Source{r, u}, nil