cli.py 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import click
  2. from ckanext.archiver import utils
  3. def get_commands():
  4. return [archiver]
  5. @click.group()
  6. def archiver():
  7. pass
  8. @archiver.command()
  9. @click.option('-q', '--queue')
  10. @click.argument('identifiers', nargs=-1)
  11. def update(identifiers, queue):
  12. utils.update(identifiers, queue)
  13. @archiver.command()
  14. def init():
  15. utils.init()
  16. click.secho("Archiver tables are initialized", fg="green")
  17. @archiver.command()
  18. @click.argument('package_ref', required=False)
  19. def view(package_ref):
  20. if package_ref:
  21. utils.view(package_ref)
  22. else:
  23. utils.view()
  24. @archiver.command()
  25. def clean_status():
  26. utils.clean_status()
  27. @archiver.command()
  28. def clean_cached_resources():
  29. utils.clean_cached_resources()
  30. @archiver.command()
  31. def migrate():
  32. utils.migrate()
  33. @archiver.command()
  34. def migrate_archive_dirs():
  35. utils.migrate_archive_dirs()
  36. @archiver.command()
  37. def size_report():
  38. utils.size_report()
  39. @archiver.command()
  40. def delete_files_larger_than_max_content_length():
  41. utils.delete_files_larger_than_max_content_length()