Sha256: aeca6386c5b3d40007e260a97329de3fa0c6598d8565384f929dd69a678d4712

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

#!/usr/bin/env python

import sys, getopt, os

this_folder = os.path.dirname(os.path.realpath(__file__))

# This updates the load path to ensure that the local site-packages directory
# can be used to load packages (e.g. a locally installed copy of lxml).
sys.path.append(os.path.join(this_folder, 'site-packages/pre_install'))

from KafNafParser import KafNafParser

def main(argv):
  conversion = ""
  try:
    opts, args = getopt.getopt(argv,"hkn",["tokaf","tonaf"])
  except getopt.GetoptError:
    print 'could not parse options. Correct usage: \n\n kaf-naf-parser.py --tokaf --tonaf'
    sys.exit(2)
  for opt, arg in opts:
    if opt == '-h':
      print 'test.py --tokaf --tonaf'
      sys.exit()
    elif opt in ("-k", "--tokaf"):
      conversion = "to-kaf"
    elif opt in ("-n", "--tonaf"):
      conversion = "to-naf"

  if conversion == "":
    conversion = "kaf-naf"

  obj = KafNafParser(sys.stdin)

  if conversion == "to-kaf":
    obj.to_kaf()
  if conversion == "to-naf":
    obj.to_naf()

  obj.dump()

if __name__ == "__main__":
  main(sys.argv[1:])

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
opener-kaf-naf-parser-1.1.0 core/kaf-naf-parser.py
opener-kaf-naf-parser-1.0.4 core/kaf-naf-parser.py
opener-kaf-naf-parser-1.0.3 core/kaf-naf-parser.py
opener-kaf-naf-parser-1.0.2 core/kaf-naf-parser.py