#!/usr/bin/env python

import os
import sys
from clint import arguments, textui

sys.path.insert(0, os.path.abspath('.'))
import jsuite

def extract(to_extract, doc):
  if to_extract == 'article-title':
    title = jsuite.extract.extract_title(doc)
    textui.puts(title)

if __name__ == "__main__":
  args = arguments.Args()

  if '--extract' in args.grouped:
    to_extract = args.grouped.get('--extract')[0]
    with open(args.files[0]) as f:
      extract(to_extract, jsuite.from_file(f))
