Open dilawar opened 1 day ago
I had introduced package_manager
field in the Package
struct.
Try doing something like:
let result = &package_manager.install(mpm::Package::new(package_name, &package_manager.pkg_manager_name(), version));
That's all fine @ss141309 . I am trying to understand why added this extra field in Package
? I missed the reason if it was in previous MRs. I also missed the api change.
Why does Package
need to know the PackageManager
?
In the latest commit related to backing up to and restoring from a TOML/JSON file, we need the package manager's name to determine the source for installing each package.
I see. Though I am still confused!
You have a list of packages that you are storing to a json. You want to write the name of package manager along with this list. This is fine. But why individual package needs to keep the name of manager? e.g. { pkg-manager: choco, list_of_packages: [p1, p2...]}
vs [ { name: p2, pkg_manager: choco, ..], { name: p2, pkg_manager: choco}, .. ]
(not correct json).
The name of package manager can be written by a function like PacakgeManager::save_packages(packages: Vec<Package>)
? Still confused why individual package needs to know the name of the package manager!
Including the package manager's name for each package now also enables us to list installed and outdated packages across all package managers with a single command, such as mpm list --all
This is breaking change. The following code doesn't work anymore.
Originally posted by @dilawar in 14967c9