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.
 
 
 

27 lines
1011 B

  1. from nilmdb.utils.printf import *
  2. import nilmdb.client
  3. from argparse import ArgumentDefaultsHelpFormatter as def_form
  4. def setup(self, sub):
  5. cmd = sub.add_parser("destroy", help="Delete a stream and all data",
  6. formatter_class = def_form,
  7. description="""
  8. Destroy the stream at the specified path. All
  9. data and metadata related to the stream is
  10. permanently deleted.
  11. """)
  12. cmd.set_defaults(handler = cmd_destroy)
  13. group = cmd.add_argument_group("Required arguments")
  14. group.add_argument("path",
  15. help="Path of the stream to delete, e.g. /foo/bar",
  16. ).completer = self.complete.path
  17. return cmd
  18. def cmd_destroy(self):
  19. """Destroy stream"""
  20. try:
  21. self.client.stream_destroy(self.args.path)
  22. except nilmdb.client.ClientError as e:
  23. self.die("error destroying stream: %s", str(e))