Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
ff7037a60c | |||
1f94120384 |
@@ -4,7 +4,6 @@ import (
|
|||||||
"cook/logger"
|
"cook/logger"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/bmatcuk/doublestar/v4"
|
"github.com/bmatcuk/doublestar/v4"
|
||||||
@@ -172,13 +171,13 @@ func LoadCommands(args []string) ([]ModifyCommand, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func LoadCommandsFromCookFiles(pattern string) ([]ModifyCommand, error) {
|
func LoadCommandsFromCookFiles(pattern string) ([]ModifyCommand, error) {
|
||||||
cwd, err := os.Getwd()
|
root, pattern, err := FigureOutGlobRoot(pattern)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to get current working directory: %w", err)
|
return nil, fmt.Errorf("failed to figure out glob root: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
commands := []ModifyCommand{}
|
commands := []ModifyCommand{}
|
||||||
cookFiles, err := doublestar.Glob(os.DirFS(cwd), pattern)
|
cookFiles, err := doublestar.Glob(os.DirFS(root), pattern)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to glob cook files: %w", err)
|
return nil, fmt.Errorf("failed to glob cook files: %w", err)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user