Ejemplo n.º 1
0
        public override IList <TaskParameter> GetTaskParameterDefinition()
        {
            bool reader(ConsoleReadContext ctx)
            {
                IDictionary <string, object> result = new Dictionary <string, object>();
                var file = UtilConsole.ReadString("Target file. Press <enter> to use a default name");

                if (string.IsNullOrEmpty(file))
                {
                    var filename = Guid.NewGuid() + ".data-gen.json";
                    file = Path.Combine(Environment.CurrentDirectory, filename);
                    UtilConsole.ColorWriteLine(ConsoleColor.DarkYellow, "  Target file would be {0}", file);
                }

                if (!GetInputForNewFile(result))
                {
                    return(false);
                }
                result[FILE] = file;
                return(true);
            }

            return(new List <TaskParameter>
            {
                new CustomConsoleTaskParameter(reader),
            });
        }