Major; refactored to use CsvCommand for initializing collate objects.
[colly.git] / colly / commands / format.py
blob02343d3f7ceb73a8d92c7f860723a88c3c020453
1 import sys
2 import logging
4 from colly.commands import CsvCommand
6 class FormatCommand(CsvCommand):
7 name = 'format'
8 usage = "%prog FILE [OPTIONS]" #: overwrites baseparser
9 summary = "Turn collated CSV file into JSON, or other format"
11 def __init__(self):
12 super(FormatCommand, self).__init__()
14 '''
15 self.parser.add_option('-f', '--format',
16 dest='format',
17 action='callback',
18 callback=headings_callback,
19 default='json',
20 type='str',
21 help='Convert to format (-f) from CSV.')
22 '''
24 def run(self, options, args):
25 print self.objects[0].as_json()
27 FormatCommand()