private TokensList LocalModules() { var local = new List <string>(); var workspace = Helper.GetWorkspaceDirectory(Directory.GetCurrentDirectory()); if (workspace != null) { Helper.SetWorkspace(workspace); local = modules.Where(Yaml.Exists).ToList(); } return(TokensList.Create(local)); }
private TokensList RemoteBranches() { var moduleDirectory = Helper.GetModuleDirectory(Directory.GetCurrentDirectory()); if (moduleDirectory == null) { return(null); } var repo = new GitRepository(moduleDirectory, log); var branches = repo.GetRemoteBranches().Select(b => b.Name); return(TokensList.Create(branches)); }
private TokensList MoudleCsprojs() { var moduleDirectory = Helper.GetModuleDirectory(Directory.GetCurrentDirectory()); if (moduleDirectory == null) { return(null); } var moduleName = Path.GetFileName(moduleDirectory); var files = Yaml.GetCsprojsList(moduleName); return(TokensList.Create(CsprojsToShortFormat(files))); }
private void InitAutomata() { var commands = new TokensList { { "build", ConfigKeyWithConfigs }, { "build-deps", ConfigKeyWithConfigs }, { "check-deps", ConfigKeyWithConfigs }, "check-pre-commit", "convert-spec", { "get", AllModules }, "help", "init", "ls", { "module", () => new TokensList { "add", { "change", AllModules } } }, { "ref", RefCompleteList }, { "analyzer", () => new TokensList { { "add" } //TODO } }, "self-update", { "show-deps", ConfigKeyWithConfigs }, { "show-configs", LocalModules }, "status", { "update", RemoteBranches }, { "update-deps", ConfigKeyWithConfigs }, { "usages", () => new TokensList { "build", { "show", ModuleKeyWithModules } } }, { "pack", MoudleCsprojs }, "--version" }; root = new TokensList { { "cm", () => commands } }; }
private TokensList RefAddComplete() { var workspace = Helper.GetWorkspaceDirectory(Directory.GetCurrentDirectory()) ?? Directory.GetCurrentDirectory(); Helper.SetWorkspace(workspace); var local = modules.Where(Yaml.Exists).ToList(); if (lastToken.Contains("/") && local.Contains(lastToken.Split('/')[0])) { var name = lastToken.Split('/')[0]; local.AddRange( Yaml.ConfigurationParser(name).GetConfigurations().Select(c => $"{name}/{c}")); } return(TokensList.Create(local, MoudleCsprojs)); }
private TokensList ConfigKeyWithConfigs() { var moduleDirectory = Helper.GetModuleDirectory(Directory.GetCurrentDirectory()); if (moduleDirectory == null) { return(null); } var moduleName = Path.GetFileName(moduleDirectory); Helper.SetWorkspace(Helper.GetWorkspaceDirectory(Directory.GetCurrentDirectory())); if (!Yaml.Exists(moduleName)) { return(null); } var configKey = new TokensList { { "-c", () => ModuleConfigs(moduleName) } }; return(configKey); }
private TokensList AllModules() { return(TokensList.Create(modules)); }
private static TokensList ModuleConfigs(string moduleName) { return(TokensList.Create( Yaml.ConfigurationParser(moduleName).GetConfigurations())); }