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
986 B

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