
import argparse
import sys


def get_argument_parser():
  parser = argparse.ArgumentParser(prog='craftr')
  return parser


def _main(argv=None):
  parser = get_argument_parser()
  args = parser.parse_args(argv)
  print('Hello, world!')
  return 0


def main():
  sys.exit(_main())

@@ -21,88 +21,1346 @@
 ort 
-sys%0A%0A%0Adef get_argument_parser():%0A  parser = argparse.ArgumentParser(prog='craftr
+os%0Aimport sys%0A%0Afrom .dsl import Parser%0A%0A%0Aclass Session:%0A  %22%22%22%0A  Implements searching for modules and caching them.%0A  %22%22%22%0A%0A  def __init__(self):%0A    self.path = %5B'.', os.path.join(os.path.dirname(__file__), 'lib')%5D%0A    self.parsed_modules = %7B%7D%0A    self.loaded_modules = %7B%7D%0A%0A  def find_module(self, name):%0A    if name in self.parsed_modules:%0A      return self.parsed_modules%5Bname%5D%0A    for path in self.path:%0A      filename = os.path.join(path, name + '.craftr')%0A      if os.path.isfile(filename):%0A        break%0A      filename = os.path.join(path, name, 'build.craftr')%0A      if os.path.isfile(filename):%0A        break%0A    else:%0A      raise ValueError(%22Unable to find module %7B!r%7D%22.format(name))%0A    with open(filename) as fp:%0A      project = Parser().parse(fp.read())%0A    if project.name != name:%0A      raise RuntimeError('project name (%7B%7D) does not match path which it was found in (%7B%7D)'%0A        .format(project.name, name))%0A    self.parsed_modules%5Bname%5D = project%0A    return project%0A%0A  def load_module(self, name):%0A    if name in self.loaded_modules:%0A      return self.loaded_modules%5Bname%5D%0A    project = self.find_module(name)%0A    raise NotImplementedError%0A%0A%0Adef get_argument_parser():%0A  parser = argparse.ArgumentParser(prog='craftr')%0A  parser.add_argument('-f', '--file', default='build.craftr', help='The Craftr build script to execute.
 ')%0A 
@@ -1468,32 +1468,111 @@
 gv)%0A
+%0A
   
-print('Hello, world!')
+with open(args.file) as fp:%0A    project = Parser().parse(fp.read())%0A  project.render(sys.stdout, 0)%0A
 %0A  r

add Session class (not used yet) and a -f, --file option