diff --git a/README.md b/README.md index 24ab12d..80300a1 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,45 @@ # FileBot -FileBot is simple file manager to automation your boring action with files e.g. moving to trash, another directory or renaming files \ No newline at end of file + +FileBot is simple file manager to automation your boring action with files e.g. moving to trash or another director + +# Configuration + +## Flags + +```text +Usage: + filebot [flags] + +Flags: + -c, --config string specific path for filebot configuration (default "/home/wittano/.config/filebot/setting.toml") + -h, --help help for filebot + -l, --log string path to log file + --logLevel string log level (default "INFO") + -u, --updateInterval duration set time after filebot should be refresh watched file state (default 10m0s) +``` + +## Configuration file + +```toml +# Example configuration for moving some files to another location +[Example] +src = ["/path/to/example.txt"] +dest = "/path/to/destination/directory" + +# You can use standard regular expression seeking your files +[SearchFilesByRegex] +src = ["/path/to/example.*", "/path/to/[0-9]ystem.txt"] +dest = "/path/to/destination/directory" + +# Automaticlly move your unnecessary files to Trash directory +[MoveToTrash] +src = ["/path/to/your/junk-file.*"] +moveToTrash = true +after = 32 # Time a last modification(in days), after that files will be moved to trash + +# Some files you don't want to move or touch by program. You can add specified file to exception list +[Exception] +src = ["/some/files.*"] +dest = "/path/to/desctination" +exceptions = ["files.pdf", "files.ini"] # Put only file name +``` \ No newline at end of file diff --git a/cmd/filebot/commands.go b/cmd/filebot/commands.go index 0cb47a4..8f10b45 100644 --- a/cmd/filebot/commands.go +++ b/cmd/filebot/commands.go @@ -16,10 +16,10 @@ var ( ) func init() { - rootCmd.PersistentFlags().StringVarP(&setting.Flags.ConfigPath, "setting", "c", setting.DefaultConfigPath(), "Specific path for filebot configuration") - rootCmd.PersistentFlags().StringVarP(&setting.Flags.LogFilePath, "log", "l", "", "Path to log file") - rootCmd.PersistentFlags().StringVarP(&setting.Flags.LogLevelName, "logLevel", "", "INFO", "Log level") - rootCmd.PersistentFlags().DurationVarP(&setting.Flags.UpdateInterval, "updateInterval", "u", setting.DefaultUpdateInterval(), "Set time after filebot should be refresh watched file state") + rootCmd.PersistentFlags().StringVarP(&setting.Flags.ConfigPath, "config", "c", setting.DefaultConfigPath(), "specific path for filebot configuration") + rootCmd.PersistentFlags().StringVarP(&setting.Flags.LogFilePath, "log", "l", "", "path to log file") + rootCmd.PersistentFlags().StringVarP(&setting.Flags.LogLevelName, "logLevel", "", "INFO", "log level") + rootCmd.PersistentFlags().DurationVarP(&setting.Flags.UpdateInterval, "updateInterval", "u", setting.DefaultUpdateInterval(), "set time after filebot should be refresh watched file state") v := validator.New(validator.WithRequiredStructEnabled()) if err := v.Struct(setting.Flags); err != nil { diff --git a/setting/flags.go b/setting/flags.go index 2380bf0..4beffe6 100644 --- a/setting/flags.go +++ b/setting/flags.go @@ -59,7 +59,7 @@ func DefaultConfigPath() string { } // TODO Change config file from TOML to YAML - return filepath.Join(homeDir, ".setting", "filebot", "setting.toml") + return filepath.Join(homeDir, ".config", "filebot", "setting.toml") } func DefaultUpdateInterval() time.Duration {