File: main.go

package info (click to toggle)
golang-github-mattn-go-zglob 0.0~git20171230.4959821-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 124 kB
  • sloc: makefile: 5
file content (29 lines) | stat: -rw-r--r-- 425 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package main

import (
	"flag"
	"fmt"
	"os"

	"github.com/mattn/go-zglob"
)

func main() {
	var d bool
	flag.BoolVar(&d, "d", false, "with directory")
	flag.Parse()
	for _, arg := range os.Args[1:] {
		matches, err := zglob.Glob(arg)
		if err != nil {
			continue
		}
		for _, m := range matches {
			if !d {
				if fi, err := os.Stat(m); err == nil && fi.Mode().IsDir() {
					continue
				}
			}
			fmt.Println(m)
		}
	}
}