From de1cb522f73b793841365214c2ed4eaac9d3149d Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Sat, 9 Mar 2024 13:41:46 -0500 Subject: [PATCH] CLI Configuration file support .conf added + doc ambiguity cleanup (#1080) --- README.md | 32 ++++++++++++-------------------- apprise/cli.py | 12 +++++++++++- packaging/man/apprise.md | 21 +++++++++------------ 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 530fe004..33573deb 100644 --- a/README.md +++ b/README.md @@ -232,43 +232,35 @@ No one wants to put their credentials out for everyone to see on the command lin # By default if no url or configuration is specified apprise will attempt to load # configuration files (if present) from: # ~/.apprise -# ~/.apprise.yml # ~/.apprise.yaml -# ~/.config/apprise -# ~/.config/apprise.yml +# ~/.config/apprise.conf # ~/.config/apprise.yaml -# /etc/apprise -# /etc/apprise.yml +# /etc/apprise.conf # /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.conf # ~/.config/apprise/apprise.yaml -# /etc/apprise/apprise -# /etc/apprise/apprise.yml # /etc/apprise/apprise.yaml +# /etc/apprise/apprise.conf # Windows users can store their default configuration files here: -# %APPDATA%/Apprise/apprise -# %APPDATA%/Apprise/apprise.yml +# %APPDATA%/Apprise/apprise.conf # %APPDATA%/Apprise/apprise.yaml -# %LOCALAPPDATA%/Apprise/apprise -# %LOCALAPPDATA%/Apprise/apprise.yml +# %LOCALAPPDATA%/Apprise/apprise.conf # %LOCALAPPDATA%/Apprise/apprise.yaml -# %ALLUSERSPROFILE%\Apprise\apprise -# %ALLUSERSPROFILE%\Apprise\apprise.yml +# %ALLUSERSPROFILE%\Apprise\apprise.conf # %ALLUSERSPROFILE%\Apprise\apprise.yaml -# %PROGRAMFILES%\Apprise\apprise -# %PROGRAMFILES%\Apprise\apprise.yml +# %PROGRAMFILES%\Apprise\apprise.conf # %PROGRAMFILES%\Apprise\apprise.yaml -# %COMMONPROGRAMFILES%\Apprise\apprise -# %COMMONPROGRAMFILES%\Apprise\apprise.yml +# %COMMONPROGRAMFILES%\Apprise\apprise.conf # %COMMONPROGRAMFILES%\Apprise\apprise.yaml +# The configuration files specified above can also be identified with a `.yml` +# extension or even just entirely removing the `.conf` extension altogether. + # 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 59a64427..11a6cbc2 100644 --- a/apprise/cli.py +++ b/apprise/cli.py @@ -67,25 +67,30 @@ CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) DEFAULT_CONFIG_PATHS = ( # Legacy Path Support '~/.apprise', + '~/.apprise.conf', '~/.apprise.yml', '~/.apprise.yaml', '~/.config/apprise', + '~/.config/apprise.conf', '~/.config/apprise.yml', '~/.config/apprise.yaml', # Plugin Support Extended Directory Search Paths '~/.apprise/apprise', + '~/.apprise/apprise.conf', '~/.apprise/apprise.yml', '~/.apprise/apprise.yaml', '~/.config/apprise/apprise', + '~/.config/apprise/apprise.conf', '~/.config/apprise/apprise.yml', '~/.config/apprise/apprise.yaml', - # Global Configuration Support + # Global Configuration File Support '/etc/apprise', '/etc/apprise.yml', '/etc/apprise.yaml', '/etc/apprise/apprise', + '/etc/apprise/apprise.conf', '/etc/apprise/apprise.yml', '/etc/apprise/apprise.yaml', ) @@ -104,9 +109,11 @@ if platform.system() == 'Windows': # Default Config Search Path for Windows Users DEFAULT_CONFIG_PATHS = ( expandvars('%APPDATA%\\Apprise\\apprise'), + expandvars('%APPDATA%\\Apprise\\apprise.conf'), expandvars('%APPDATA%\\Apprise\\apprise.yml'), expandvars('%APPDATA%\\Apprise\\apprise.yaml'), expandvars('%LOCALAPPDATA%\\Apprise\\apprise'), + expandvars('%LOCALAPPDATA%\\Apprise\\apprise.conf'), expandvars('%LOCALAPPDATA%\\Apprise\\apprise.yml'), expandvars('%LOCALAPPDATA%\\Apprise\\apprise.yaml'), @@ -116,16 +123,19 @@ if platform.system() == 'Windows': # C:\ProgramData\Apprise\ expandvars('%ALLUSERSPROFILE%\\Apprise\\apprise'), + expandvars('%ALLUSERSPROFILE%\\Apprise\\apprise.conf'), expandvars('%ALLUSERSPROFILE%\\Apprise\\apprise.yml'), expandvars('%ALLUSERSPROFILE%\\Apprise\\apprise.yaml'), # C:\Program Files\Apprise expandvars('%PROGRAMFILES%\\Apprise\\apprise'), + expandvars('%PROGRAMFILES%\\Apprise\\apprise.conf'), expandvars('%PROGRAMFILES%\\Apprise\\apprise.yml'), expandvars('%PROGRAMFILES%\\Apprise\\apprise.yaml'), # C:\Program Files\Common Files expandvars('%COMMONPROGRAMFILES%\\Apprise\\apprise'), + expandvars('%COMMONPROGRAMFILES%\\Apprise\\apprise.conf'), expandvars('%COMMONPROGRAMFILES%\\Apprise\\apprise.yml'), expandvars('%COMMONPROGRAMFILES%\\Apprise\\apprise.yaml'), ) diff --git a/packaging/man/apprise.md b/packaging/man/apprise.md index c3ae6d80..4b12abc1 100644 --- a/packaging/man/apprise.md +++ b/packaging/man/apprise.md @@ -188,27 +188,24 @@ command line and all of them will be loaded. You can also point your configurat a cloud location (by referencing `http://` or `https://`. By default **apprise** looks in the following local locations for configuration files and loads them: - ~/.apprise - ~/.apprise.yml + ~/.apprise.conf ~/.apprise.yaml - ~/.config/apprise - ~/.config/apprise.yml + ~/.config/apprise.conf ~/.config/apprise.yaml - ~/.apprise/apprise - ~/.apprise/apprise.yml + ~/.apprise/apprise.conf ~/.apprise/apprise.yaml - ~/.config/apprise/apprise - ~/.config/apprise/apprise.yml + ~/.config/apprise/apprise.conf ~/.config/apprise/apprise.yaml - /etc/apprise - /etc/apprise.yml + /etc/apprise.conf /etc/apprise.yaml - /etc/apprise/apprise - /etc/apprise/apprise.yml + /etc/apprise/apprise.conf /etc/apprise/apprise.yaml +The **configuration files** specified above can also be identified with a `.yml` +extension or even just entirely removing the `.conf` extension altogether. + 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** tool simplifies to: