Skip to content

Commit

Permalink
Merge branch 'master' into pr-main-py
Browse files Browse the repository at this point in the history
- handle check_install by passing parser as first argument
  • Loading branch information
perrette committed Apr 24, 2023
2 parents 80d00d3 + 582583e commit 956fb1b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions papers/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def uninstallcmd(o, config):
config.file = search_config([os.path.join(".papers", "config.json")], start_dir=".", default=CONFIG_FILE)
uninstallcmd(o, config)

def check_install(o, config):
def check_install(parser, o, config):
"""
Given an option and config, checks to see if the install is done correctly on this filesystem.
"""
Expand All @@ -221,8 +221,8 @@ def check_install(o, config):
elif not os.path.exists(config.bibtex):
print(f'papers: error: no bibtex file found, do `touch {config.bibtex}` or {install_doc}')
parser.exit(1)
logger.info('bibtex: '+config.bibtex)
logger.info('filesdir: '+config.filesdir)
logger.info(f'bibtex: {config.bibtex!r}')
logger.info(f'filesdir: {config.filesdir!r}')
return True

def addcmd(o, config):
Expand Down Expand Up @@ -820,17 +820,17 @@ def main():
uninstallcmd(o, config)
print(config.status(verbose=True))
elif o.cmd == 'add':
check_install(o, config) and addcmd(o, config)
check_install(parser, o, config) and addcmd(o, config)
elif o.cmd == 'check':
check_install(o, config) and checkcmd(o, config)
check_install(parser, o, config) and checkcmd(o, config)
elif o.cmd == 'filecheck':
check_install(o, config) and filecheckcmd(o, config)
check_install(parser, o, config) and filecheckcmd(o, config)
elif o.cmd == 'list':
check_install(o, config) and listcmd(o, config)
check_install(parser, o, config) and listcmd(o, config)
elif o.cmd == 'undo':
check_install(o, config) and undocmd(o, config)
check_install(parser, o, config) and undocmd(o, config)
elif o.cmd == 'git':
check_install(o, config) and gitcmd(o, config)
check_install(parser, o, config) and gitcmd(o, config)
elif o.cmd == 'doi':
doicmd(o)
elif o.cmd == 'fetch':
Expand Down

0 comments on commit 956fb1b

Please sign in to comment.