From 645baeb55c4b0554bc803324d43e042403035018 Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Sun, 3 Mar 2024 17:59:06 -0500 Subject: [PATCH] Support both .yaml and .yml config files via CLI (#1073) --- README.md | 11 +++++++++++ apprise/cli.py | 11 +++++++++++ packaging/man/apprise.md | 6 ++++++ 3 files changed, 28 insertions(+) diff --git a/README.md b/README.md index 27a42315..530fe004 100644 --- a/README.md +++ b/README.md @@ -233,30 +233,41 @@ No one wants to put their credentials out for everyone to see on the command lin # configuration files (if present) from: # ~/.apprise # ~/.apprise.yml +# ~/.apprise.yaml # ~/.config/apprise # ~/.config/apprise.yml +# ~/.config/apprise.yaml # /etc/apprise # /etc/apprise.yml +# /etc/apprise.yaml # Also a subdirectory handling allows you to leverage plugins # ~/.apprise/apprise # ~/.apprise/apprise.yml +# ~/.apprise/apprise.yaml # ~/.config/apprise/apprise # ~/.config/apprise/apprise.yml +# ~/.config/apprise/apprise.yaml # /etc/apprise/apprise # /etc/apprise/apprise.yml +# /etc/apprise/apprise.yaml # Windows users can store their default configuration files here: # %APPDATA%/Apprise/apprise # %APPDATA%/Apprise/apprise.yml +# %APPDATA%/Apprise/apprise.yaml # %LOCALAPPDATA%/Apprise/apprise # %LOCALAPPDATA%/Apprise/apprise.yml +# %LOCALAPPDATA%/Apprise/apprise.yaml # %ALLUSERSPROFILE%\Apprise\apprise # %ALLUSERSPROFILE%\Apprise\apprise.yml +# %ALLUSERSPROFILE%\Apprise\apprise.yaml # %PROGRAMFILES%\Apprise\apprise # %PROGRAMFILES%\Apprise\apprise.yml +# %PROGRAMFILES%\Apprise\apprise.yaml # %COMMONPROGRAMFILES%\Apprise\apprise # %COMMONPROGRAMFILES%\Apprise\apprise.yml +# %COMMONPROGRAMFILES%\Apprise\apprise.yaml # If you loaded one of those files, your command line gets really easy: apprise -vv -t 'my title' -b 'my notification body' diff --git a/apprise/cli.py b/apprise/cli.py index 0e16b99f..59a64427 100644 --- a/apprise/cli.py +++ b/apprise/cli.py @@ -68,20 +68,26 @@ DEFAULT_CONFIG_PATHS = ( # Legacy Path Support '~/.apprise', '~/.apprise.yml', + '~/.apprise.yaml', '~/.config/apprise', '~/.config/apprise.yml', + '~/.config/apprise.yaml', # Plugin Support Extended Directory Search Paths '~/.apprise/apprise', '~/.apprise/apprise.yml', + '~/.apprise/apprise.yaml', '~/.config/apprise/apprise', '~/.config/apprise/apprise.yml', + '~/.config/apprise/apprise.yaml', # Global Configuration Support '/etc/apprise', '/etc/apprise.yml', + '/etc/apprise.yaml', '/etc/apprise/apprise', '/etc/apprise/apprise.yml', + '/etc/apprise/apprise.yaml', ) # Define our paths to search for plugins @@ -99,8 +105,10 @@ if platform.system() == 'Windows': DEFAULT_CONFIG_PATHS = ( expandvars('%APPDATA%\\Apprise\\apprise'), expandvars('%APPDATA%\\Apprise\\apprise.yml'), + expandvars('%APPDATA%\\Apprise\\apprise.yaml'), expandvars('%LOCALAPPDATA%\\Apprise\\apprise'), expandvars('%LOCALAPPDATA%\\Apprise\\apprise.yml'), + expandvars('%LOCALAPPDATA%\\Apprise\\apprise.yaml'), # # Global Support @@ -109,14 +117,17 @@ if platform.system() == 'Windows': # C:\ProgramData\Apprise\ expandvars('%ALLUSERSPROFILE%\\Apprise\\apprise'), expandvars('%ALLUSERSPROFILE%\\Apprise\\apprise.yml'), + expandvars('%ALLUSERSPROFILE%\\Apprise\\apprise.yaml'), # C:\Program Files\Apprise expandvars('%PROGRAMFILES%\\Apprise\\apprise'), expandvars('%PROGRAMFILES%\\Apprise\\apprise.yml'), + expandvars('%PROGRAMFILES%\\Apprise\\apprise.yaml'), # C:\Program Files\Common Files expandvars('%COMMONPROGRAMFILES%\\Apprise\\apprise'), expandvars('%COMMONPROGRAMFILES%\\Apprise\\apprise.yml'), + expandvars('%COMMONPROGRAMFILES%\\Apprise\\apprise.yaml'), ) # Default Plugin Search Path for Windows Users diff --git a/packaging/man/apprise.md b/packaging/man/apprise.md index d310e9c7..c3ae6d80 100644 --- a/packaging/man/apprise.md +++ b/packaging/man/apprise.md @@ -190,18 +190,24 @@ in the following local locations for configuration files and loads them: ~/.apprise ~/.apprise.yml + ~/.apprise.yaml ~/.config/apprise ~/.config/apprise.yml + ~/.config/apprise.yaml ~/.apprise/apprise ~/.apprise/apprise.yml + ~/.apprise/apprise.yaml ~/.config/apprise/apprise ~/.config/apprise/apprise.yml + ~/.config/apprise/apprise.yaml /etc/apprise /etc/apprise.yml + /etc/apprise.yaml /etc/apprise/apprise /etc/apprise/apprise.yml + /etc/apprise/apprise.yaml If a default configuration file is referenced in any way by the **apprise** tool, you no longer need to provide it a Service URL. Usage of the **apprise**