fmt: onfileindir (#295)

This commit is contained in:
James Read 2024-04-27 00:02:40 +01:00 committed by GitHub
parent ceb215a6dc
commit 6a16a7c6c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 5 deletions

View File

@ -1,13 +1,13 @@
package onfileindir package onfileindir
import ( import (
"fmt"
"github.com/OliveTin/OliveTin/internal/acl" "github.com/OliveTin/OliveTin/internal/acl"
"github.com/OliveTin/OliveTin/internal/config" "github.com/OliveTin/OliveTin/internal/config"
"github.com/OliveTin/OliveTin/internal/executor" "github.com/OliveTin/OliveTin/internal/executor"
"github.com/OliveTin/OliveTin/internal/filehelper" "github.com/OliveTin/OliveTin/internal/filehelper"
"path/filepath"
"os" "os"
"fmt" "path/filepath"
) )
func WatchFilesInDirectory(cfg *config.Config, ex *executor.Executor) { func WatchFilesInDirectory(cfg *config.Config, ex *executor.Executor) {
@ -30,8 +30,8 @@ func scheduleExec(action *config.Action, cfg *config.Config, ex *executor.Execut
args := map[string]string{ args := map[string]string{
"filepath": path, "filepath": path,
"filename": filepath.Base(path), "filename": filepath.Base(path),
"filedir": filepath.Dir(path), "filedir": filepath.Dir(path),
"fileext": filepath.Ext(path), "fileext": filepath.Ext(path),
} }
if stat, err := os.Stat(path); err == nil { if stat, err := os.Stat(path); err == nil {
@ -47,7 +47,7 @@ func scheduleExec(action *config.Action, cfg *config.Config, ex *executor.Execut
ActionTitle: action.Title, ActionTitle: action.Title,
Cfg: cfg, Cfg: cfg,
Tags: []string{"fileindir"}, Tags: []string{"fileindir"},
Arguments: args, Arguments: args,
AuthenticatedUser: &acl.AuthenticatedUser{ AuthenticatedUser: &acl.AuthenticatedUser{
Username: "fileindir", Username: "fileindir",
}, },