You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

28 lines
953 B

  1. #!/usr/bin/env python3
  2. import nilmdb.fsck
  3. import argparse
  4. def main():
  5. """Main entry point for the 'nilmdb-fsck' command line script"""
  6. parser = argparse.ArgumentParser(
  7. description='Check database consistency',
  8. formatter_class=argparse.ArgumentDefaultsHelpFormatter)
  9. parser.add_argument("-v", "--version", action="version",
  10. version=nilmdb.__version__)
  11. parser.add_argument("-f", "--fix", action="store_true",
  12. default=False, help='Fix errors when possible '
  13. '(which may involve removing data)')
  14. parser.add_argument("-n", "--no-data", action="store_true",
  15. default=False, help='Skip the slow full-data check')
  16. parser.add_argument('database', help='Database directory')
  17. args = parser.parse_args()
  18. nilmdb.fsck.Fsck(args.database, args.fix).check(skip_data=args.no_data)
  19. if __name__ == "__main__":
  20. main()