public void Execute(string[] args) { if (args.Contains("--local")) { var current_dir = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar; var installed = InstalledPackages.Deserialize(current_dir); Console.WriteLine($"{installed.Packages.Count} packages found."); foreach (var package in installed.Packages) { Console.WriteLine($"- {package.Key}"); } } else { var finder = new PackageFinder(); var list = finder.FindAll(); Console.WriteLine($"{list.Count} packages found."); foreach (var name in list) { Console.WriteLine($"- {name}"); } } }
public void Execute(string[] args) { var isLocal = false; if (args.Contains("--local")) { isLocal = true; args = args.Where(arg => arg != "--local") .ToArray(); } if (args.Length < 1) { LogTracer.LogError("[ERROR] The command, \"plpm check\" requires 1 arg."); return; } var package_name = args[0]; if (isLocal) { var current_dir = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar; var installed = InstalledPackages.Deserialize(current_dir); var packageID = installed.Packages.FirstOrDefault(pkg => pkg.Key == package_name).Value; var is_latest = PackageInfo.LoadInfo(package_name).Identification == packageID; Console.WriteLine($"Package name : {package_name}"); Console.WriteLine($"Package ID : {packageID}"); Console.WriteLine($"Is latest : {is_latest}"); } else { var info = PackageInfo.LoadInfo(package_name); Console.WriteLine($"Package name : {package_name}"); Console.WriteLine($"Package ID : {info.Identification}"); Console.WriteLine($"Description : {info.Description}"); Console.WriteLine($"Files : |"); foreach (var file in info.Files) { Console.WriteLine($"- {file}"); } } }