diff --git a/jrnl/args.py b/jrnl/args.py index c8bd7743..e7980ac5 100644 --- a/jrnl/args.py +++ b/jrnl/args.py @@ -337,6 +337,28 @@ def parse_args(args=[]): """, ) + alternate_config = parser.add_argument_group( + "Specifies alternate config to be used", + textwrap.dedent("Applies alternate config for current session"), + ) + alternate_config.add_argument( + "--config-file", + dest="config_file", + action="config_file", + type=str, + nargs=1, + default="", + help=""" + Overrides default (created when first installed) config file for this command only. + + Examples: \n + \t - Use a work config file for this jrnl entry, call: \n + \t jrnl --config-file /home/user1/work_config.yaml + \t - Use a personal config file stored on a thumb drive: \n + \t jrnl --config-file /media/user1/my-thumb-drive/personal_config.yaml + """, + ) + # Handle '-123' as a shortcut for '-n 123' num = re.compile(r"^-(\d+)$") args = [num.sub(r"-n \1", arg) for arg in args] diff --git a/jrnl/install.py b/jrnl/install.py index db4c0fba..ce9c5415 100644 --- a/jrnl/install.py +++ b/jrnl/install.py @@ -38,7 +38,8 @@ def upgrade_config(config): def load_or_install_jrnl(): """ - If jrnl is already installed, loads and returns a config object. + If jrnl is already installed, loads and returns a default config object. + If alternate config is specified via --config-file flag, it will be used. Else, perform various prompts to install jrnl. """ config_path = (