#!/usr/bin/env python

"""
converts a JavaScipt file to a plugin tiddler (JSON format)
"""

import sys
import json

from urllib2 import urlopen


def main(args):
	args = [unicode(arg, "utf-8") for arg in args]

	uri = args[1]
	try:
		f = open(uri)
		source = f.read()
		f.close()
	except IOError:
		source = urlopen(uri).read()

	filename = uri.rsplit("/", 1)[1]

	tiddler = {
		"title": filename.rsplit(".", 1)[0],
		"tags": ["systemConfig"],
		"text": source
	}

	print json.dumps(tiddler)

	return True


if __name__ == "__main__":
	status = not main(sys.argv)
	sys.exit(status)

8a6e6b151308b9ac0c90bd7a23d9e545f96b09d5
#!/usr/bin/env python

"""
converts a JavaScipt file to a plugin tiddler (JSON format)
"""

import sys
import json

from urllib2 import urlopen


def main(args):
	args = [unicode(arg, "utf-8") for arg in args]

	uri = args[1]
	try:
		f = open(uri)
		source = f.read()
		f.close()
	except IOError:
		source = urlopen(uri).read()

	filename = uri.rsplit("/", 1)[1]

	tiddler = {
		"title": filename.rsplit(".", 1)[0],
		"tags": ["systemConfig"],
		"text": source
	}

	print json.dumps(tiddler)

	return True


if __name__ == "__main__":
	status = not main(sys.argv)
	sys.exit(status)
