mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-18 20:18:32 +02:00
added new CLI argument option --config-file
This commit is contained in:
parent
5e87ff1ce6
commit
89eb3d0193
2 changed files with 24 additions and 1 deletions
22
jrnl/args.py
22
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]
|
||||
|
|
|
@ -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 = (
|
||||
|
|
Loading…
Add table
Reference in a new issue