import argparse import logging from pathlib import Path from . import import_data logger = logging.getLogger(__name__) def parse_arguments(): parser = argparse.ArgumentParser() parser.add_argument('--vault', type=Path, required=True) parser.add_argument('--yes', action='store_false', dest='dry_run') return parser.parse_args() def main(): # Setup logging logging.basicConfig() logging.getLogger('obsidian_import').setLevel('INFO') args = parse_arguments() if args.dry_run: logger.warning('Dry run') import_data(args.vault, dry_run=args.dry_run) if args.dry_run: logger.warning('Dry run: Use --yes to execute') if __name__ == '__main__': main()