コード例 #1
0
        public static CodeGeneratorOptions ParseArguments(ICollection <string> args)
        {
            var options   = new CodeGeneratorOptions();
            var optionSet = new OptionSet
            {
                {
                    "worker-json-dir=", "REQUIRED: the directory that will contain the JSON representation of your workers",
                    j => options.WorkerJsonDirectory = j
                },
                {
                    "json-dir=", "REQUIRED: the directory that will contain the JSON representation of your schema",
                    j => options.JsonDirectory = j
                },
                {
                    "descriptor-dir=", "REQUIRED: the directory that will contain the Schema Descriptor",
                    j => options.DescriptorDirectory = j
                },
                {
                    "native-output-dir=", "REQUIRED: the directory to output generated components and structs to",
                    u => options.NativeOutputDirectory = u
                },
                {
                    "schema-path=", "REQUIRED: a comma-separated list of directories that contain schema files",
                    u => options.SchemaInputDirs.Add(u)
                },
                {
                    "schema-compiler-path=", "REQUIRED: the path to the CoreSdk schema compiler",
                    u => options.SchemaCompilerPath = u
                },
                {
                    "serialization-override=", "OPTIONAL: defines an override for serialization of a single type",
                    u => options.SerializationOverrides.Add(u)
                },
                {
                    "log-file=", "REQUIRED: absolute path to logger output file",
                    p => options.AbsoluteLogPath = p
                },
                {
                    "h|help", "Show help",
                    h => options.ShouldShowHelp = h != null
                },
                {
                    "v|verbose", "Enable verbose logging",
                    q => options.Verbose = q != null
                },
                {
                    "disable-stdout", "Disable logging to stdout",
                    d => options.EnableLoggingToStdout = d == null
                },
                {
                    "f|force", "Force generating code.",
                    d => options.Force = true
                },
            };

            optionSet.Parse(args);

            using (var sw = new StringWriter())
            {
                optionSet.WriteOptionDescriptions(sw);
                options.HelpText = sw.ToString();
            }

            Instance = options;

            return(options);
        }
コード例 #2
0
 public CodeGenerator(CodeGeneratorOptions options, IFileSystem fileSystem)
 {
     this.options    = options;
     this.fileSystem = fileSystem;
 }