package org.metaborg.sunshine;

import org.metaborg.spoofax.meta.core.SpoofaxMetaModule;

import com.google.inject.Guice;
import com.google.inject.Injector;
import com.martiansoftware.nailgun.NGContext;

public class Main {
    private static Injector injector;


    public static void main(String[] args) {
        injector = Guice.createInjector(new SunshineModule()).createChildInjector(new SpoofaxMetaModule());

        run(args, false);
    }

    public static void nailMain(NGContext context) {
        run(context.getArgs(), true);
    }


    private static void run(String[] args, boolean remote) {
        final Runner runner = injector.getInstance(Runner.class);
        final int result = runner.run(args, remote);
        System.exit(result);
    }
}

@@ -49,77 +49,125 @@
 org.
-spoofax.meta.core.SpoofaxMetaModule;%0A%0Aimport com.google.inject.Guice;
+core.MetaborgException;%0Aimport org.metaborg.spoofax.core.Spoofax;%0Aimport org.metaborg.spoofax.meta.core.SpoofaxMeta;%0A
 %0Aimp
@@ -347,16 +347,41 @@
 %5B%5D args)
+ throws MetaborgException
  %7B%0A     
@@ -387,87 +387,153 @@
     
+f
 in
-jector = Guice.createInjector(new SunshineModule()).createChildI
+al Spoofax spoofax = new Spoofax(new SunshineModule());%0A        final SpoofaxMeta spoofaxMeta = new SpoofaxMeta(spoofax);%0A        i
 njector
-(new S
+ = s
 poof
@@ -538,24 +538,26 @@
 ofaxMeta
-Module()
+.injector(
 );%0A%0A    

Use facade instead of instantiating injectors manually.