protected override int Execute() { var searchOption = RecursiveOption.HasValue() ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; var allFiles = Directory.EnumerateFiles(WorkingDirectory, "*.json", searchOption); //json only for now var currentWorkingDirectory = WorkingDirectory; foreach (var file in allFiles) { // load file and check whether it contains a known structure for Genyman // if it does, execute it var contents = File.ReadAllText(file); if (contents.Contains("\"genyman\":")) { var fileInfo = new FileInfo(file); var args = new List <string>(Generator.Args); args.Remove("all"); args.Remove("--recursive"); args.Insert(0, fileInfo.Name); Log.Debug($"Switchting to {fileInfo.DirectoryName}"); Directory.SetCurrentDirectory(fileInfo.DirectoryName); GenymanApplication.Run <Configuration, NewTemplate, Generator>(args.ToArray(), true, subcommands => { }); } } Directory.SetCurrentDirectory(currentWorkingDirectory); return(0); }
public static void Main(string[] args) { Generator.Args = args; GenymanApplication.Run <Configuration, NewTemplate, Generator>(args, true, subcommands => { subcommands.Add(new DeployCommand()); subcommands.Add(new AllCommand()); }); }
public static void Main(string[] args) { GenymanApplication.Run <Configuration, NewTemplate, Generator>(args); }