Esempio n. 1
0
        private static void ProcessCommand(string verb, object options)
        {
            try
            {
                var tool = new LocalizationTool();

                switch (verb)
                {
                case "ext":
                    tool.ExtractLocalizableItems(options as ExtractOptions);
                    break;

                case "gen":
                    tool.GenerateProjectTemplatesAndCommandsHandler(options as GenerationOptions);
                    break;

                case "verify":
                    var result = tool.VerifyLocalizableItems(options as VerifyOptions);
                    if (!result)
                    {
                        ExitWithError();
                    }

                    break;
                }
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine($"Error executing command {verb}:");
                Console.Error.WriteLine(ex.ToString());
                ExitWithError();
            }
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            var tool = new LocalizationTool();

            var parserResult = Parser.Default.ParseArguments <ExtractOptions, GenerationOptions, MergeOptions, VerifyOptions>(args);

            parserResult
            .WithParsed <ExtractOptions>(options => tool.ExtractLocalizableItems(options))
            .WithParsed <GenerationOptions>(options => tool.GenerateTemplatesItems(options))
            .WithParsed <MergeOptions>(options => tool.MergeLocalizableItems(options))
            .WithParsed <VerifyOptions>(options => tool.VerifyLocalizableItems(options))
            .WithNotParsed(error =>
            {
                var appTitle = new HelpText
                {
                    Heading   = HeadingInfo.Default,
                    Copyright = CopyrightInfo.Default,
                    AdditionalNewLineAfterOption = true,
                    AddDashesToOption            = true,
                };
            });
        }