Skip to content
This repository has been archived by the owner on Apr 16, 2023. It is now read-only.

Change default config path #60

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
setup_requires=setup_requires,
use_scm_version=True,
install_requires=['platformdirs'],
classifiers=[
"Development Status :: 4 - Beta",
"License :: OSI Approved :: GNU General Public License (GPL)",
Expand Down
8 changes: 6 additions & 2 deletions src/ydcv.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
import random
import os
import configparser
from platformdirs import PlatformDirs

dirs = PlatformDirs('ydcv')
DEFAULT_CONFIG = os.path.join(dirs.user_config_dir, 'ydcv.ini')

try:
# Py3
Expand Down Expand Up @@ -335,8 +339,8 @@ def arg_parse():
"Default: zh-CHS for non-chinese characters, EN if Chinese character queried.")
parser.add_argument('-c', '--config',
action="store",
default="~/.ydcv",
help="Config file contains API AppKey / SecKey. Default: ~/.ydcv")
default=DEFAULT_CONFIG,
help=f"Config file contains API AppKey / SecKey. Default: {DEFAULT_CONFIG}")
parser.add_argument('words',
nargs='*',
help="words to lookup, or quoted sentences to translate.")
Expand Down