mirror of
https://github.com/charmbracelet/glow
synced 2024-12-14 06:02:27 +00:00
When passed a directory as cli-arg, find a README[.md] in it
This commit is contained in:
parent
37c9cfad80
commit
95670866e0
1 changed files with 3 additions and 2 deletions
5
main.go
5
main.go
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue