Пример #1
0
        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));
        }
Пример #2
0
        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));
        }
Пример #3
0
        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)));
        }
Пример #4
0
        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 }
            };
        }
Пример #5
0
        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));
        }
Пример #6
0
        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);
        }
Пример #7
0
 private TokensList AllModules()
 {
     return(TokensList.Create(modules));
 }
Пример #8
0
 private static TokensList ModuleConfigs(string moduleName)
 {
     return(TokensList.Create(
                Yaml.ConfigurationParser(moduleName).GetConfigurations()));
 }