File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ package main
44
55import (
66 "os"
7+ "path/filepath"
78 "runtime"
89
910 "github.com/boyter/hashit/processor"
@@ -21,7 +22,18 @@ func main() {
2122 Long : "Hash It!\n Version " + processor .Version + "\n Ben Boyter <ben@boyter.org>" ,
2223 Version : processor .Version ,
2324 Run : func (cmd * cobra.Command , args []string ) {
24- processor .DirFilePaths = args
25+ var filePaths []string
26+ for _ , arg := range args {
27+ matches , err := filepath .Glob (arg )
28+ if err != nil || len (matches ) == 0 {
29+ // If there's an error or no matches, treat the argument as a literal path
30+ filePaths = append (filePaths , arg )
31+ } else {
32+ filePaths = append (filePaths , matches ... )
33+ }
34+ }
35+
36+ processor .DirFilePaths = filePaths
2537 processor .Process ()
2638 },
2739 }
Original file line number Diff line number Diff line change 4343 exit
4444fi
4545
46+ if ./hashit " *.go" | grep -q -i ' main.go' ; then
47+ echo -e " ${GREEN} PASSED globbing test for *.go"
48+ else
49+ echo -e " ${RED} ======================================================="
50+ echo -e " FAILED Globbing test for *.go"
51+ echo -e " ======================================================="
52+ exit
53+ fi
54+
4655if ./hashit --debug --trace --verbose -f text --hash md5 --no-stream --stream-size 10 -r main.go > /dev/null ; then
4756 echo -e " ${GREEN} PASSED multiple options test"
4857else
You can’t perform that action at this time.
0 commit comments