Skip to content

Commit 87bbe0a

Browse files
committed
cli: Expand env vars of $XDG_CONFIG_HOME
1 parent 2d53e75 commit 87bbe0a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sphinxnotes/snippet/cli.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
from .cache import Cache
2323
from .table import tablify, COLUMNS
2424

25-
DEFAULT_CONFIG_FILE = path.join(xdg_config_home, *__title__.split('-'), 'conf.py')
25+
# Neovim's $XDG_CONFIG_HOME is "$HOME/.config", expand for it.
26+
DEFAULT_CONFIG_FILE = path.join(path.expandvars(xdg_config_home), *__title__.split('-'), 'conf.py')
2627

2728
class HelpFormatter(argparse.ArgumentDefaultsHelpFormatter,
2829
argparse.RawDescriptionHelpFormatter): pass
@@ -102,7 +103,7 @@ def main(argv:List[str]=sys.argv[1:]) -> int:
102103

103104
# Load config from file
104105
if args.config == DEFAULT_CONFIG_FILE and not path.isfile(DEFAULT_CONFIG_FILE):
105-
print('the default configuration file does not exist, ignore it', file=sys.stderr)
106+
print(f'the default configuration file {DEFAULT_CONFIG_FILE} does not exist, ignore it', file=sys.stderr)
106107
cfg = Config({})
107108
else:
108109
cfg = Config.load(args.config)
@@ -119,6 +120,7 @@ def main(argv:List[str]=sys.argv[1:]) -> int:
119120
else:
120121
parser.print_help()
121122

123+
return 0
122124

123125
def _on_command_stat(args:argparse.Namespace):
124126
cache = args.cache

0 commit comments

Comments
 (0)