1# http://pyrocko.org - GPLv3 

2# 

3# The Pyrocko Developers, 21st Century 

4# ---|P------/S----------~Lg---------- 

5 

6import logging 

7 

8from ..common import SquirrelCommand 

9 

10logger = logging.getLogger('psq.cli.remove') 

11 

12headline = 'Remove entries from selection or database.' 

13 

14description = '''%s 

15 

16Allows selective removal of cached metadata from Squirrel's database. 

17 

18Currently only removal of waveform promises is supported. 

19''' % headline 

20 

21 

22class Promises(SquirrelCommand): 

23 

24 def make_subparser(self, subparsers): 

25 return subparsers.add_parser( 

26 'promises', 

27 help='Remove all waveform promises in the selection.', 

28 description='Remove all waveform promises in the selection.') 

29 

30 def setup(self, parser): 

31 parser.add_squirrel_selection_arguments() 

32 

33 def run(self, parser, args): 

34 s = args.make_squirrel() 

35 s.remove_waveform_promises(from_database='global') 

36 

37 

38def make_subparser(subparsers): 

39 return subparsers.add_parser( 

40 'remove', 

41 help=headline, 

42 subcommands=[Promises()], 

43 description=description) 

44 

45 

46def setup(parser): 

47 pass 

48 

49 

50def run(parser, args): 

51 parser.print_help()