summaryrefslogtreecommitdiff
path: root/poezio/args.py
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-07-03 12:32:31 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-07-03 12:32:37 +0200
commitb80bb2fcfcceb9b00a3fec02280e93da33ba8bd0 (patch)
treea16b35eed09e8b5465585626cd6dfa9e262d66cc /poezio/args.py
parent5483cd40ee1e84e86bfe775ba06ca9d7d5d5a0ea (diff)
downloadpoezio-b80bb2fcfcceb9b00a3fec02280e93da33ba8bd0.tar.gz
poezio-b80bb2fcfcceb9b00a3fec02280e93da33ba8bd0.tar.bz2
poezio-b80bb2fcfcceb9b00a3fec02280e93da33ba8bd0.tar.xz
poezio-b80bb2fcfcceb9b00a3fec02280e93da33ba8bd0.zip
Only create the config dir after parsing the CLI args.
This also switches to pathlib.Path instead of os.path for path manipulation.
Diffstat (limited to 'poezio/args.py')
-rw-r--r--poezio/args.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/poezio/args.py b/poezio/args.py
index 71ae7488..31525bb2 100644
--- a/poezio/args.py
+++ b/poezio/args.py
@@ -3,11 +3,11 @@ Module related to the argument parsing
There is a fallback to the deprecated optparse if argparse is not found
"""
-from os import path
+from pathlib import Path
from argparse import ArgumentParser, SUPPRESS
-def parse_args(CONFIG_PATH=''):
+def parse_args(CONFIG_PATH: Path):
"""
Parse the arguments from the command line
"""
@@ -28,7 +28,8 @@ def parse_args(CONFIG_PATH=''):
"-f",
"--file",
dest="filename",
- default=path.join(CONFIG_PATH, 'poezio.cfg'),
+ default=CONFIG_PATH / 'poezio.cfg',
+ type=Path,
help="The config file you want to use",
metavar="CONFIG_FILE")
parser.add_argument(