diff --git a/providers/os/os.go b/providers/os/os.go index e648b59..ed6179a 100644 --- a/providers/os/os.go +++ b/providers/os/os.go @@ -38,8 +38,9 @@ func (this *Provider) FuncMapFor (document *step.Document) template.FuncMap { "listFilesDate": stat.funcListFilesDate, "writeFile": stat.funcWriteFile, "appendFile": stat.funcAppendFile, - "renameFile": stat.funcRenameFile, "removeFile": stat.funcRemoveFile, + "rename": stat.funcRename, + // TODO: createDir, createDirAll, removeDir, chmod } } @@ -149,18 +150,18 @@ func (this *state) funcAppendFile (name, content string) error { return err } -func (this *state) funcRenameFile (name, newName string) error { - name, err := this.document.Rel(name) - if err != nil { return err } - return os.Rename(name, newName) -} - func (this *state) funcRemoveFile (name string) error { name, err := this.document.Rel(name) if err != nil { return err } return os.Remove(name) } +func (this *state) funcRename (name, newName string) error { + name, err := this.document.Rel(name) + if err != nil { return err } + return os.Rename(name, newName) +} + func sortDirEntriesByDate(entries []fs.DirEntry) { sort.Slice(entries, func(left, right int) bool{ var leftTime time.Time