1
0
personal-data/obsidian_import/__main__.py

32 lines
718 B
Python
Raw Normal View History

2024-10-03 21:23:47 +00:00
import argparse
import logging
from pathlib import Path
from . import import_data
logger = logging.getLogger(__name__)
2024-10-03 21:24:12 +00:00
2024-10-03 21:23:47 +00:00
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')
2024-10-03 21:24:12 +00:00
import_data(args.vault, dry_run=args.dry_run)
2024-10-03 21:23:47 +00:00
if args.dry_run:
logger.warning('Dry run: Use --yes to execute')
if __name__ == '__main__':
main()