#!/usr/bin/env python """ jrnl license: GPLv3, see LICENSE.md for more details. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . """ import logging import sys from .jrnl import run from .args import parse_args def configure_logger(debug=False): if not debug: logging.disable() return logging.basicConfig( level=logging.DEBUG, format="%(levelname)-8s %(name)-12s %(message)s", ) logging.getLogger("parsedatetime").setLevel(logging.INFO) logging.getLogger("keyring.backend").setLevel(logging.ERROR) def cli(manual_args=None): try: if manual_args is None: manual_args = sys.argv[1:] args = parse_args(manual_args) configure_logger(args.debug) logging.debug("Parsed args: %s", args) return run(args) except KeyboardInterrupt: return 1