Mercurial > hg > octave-terminal
changeset 12778:0ca5672d5f1a
Implement pkg update command
author | Lukas Reichlin <lukas.reichlin@gmail.com> |
---|---|
date | Thu, 07 Jul 2011 19:16:14 -0400 |
parents | 6c1d0f03c331 |
children | ad9263d965dc 095fd5c8b7e1 |
files | scripts/pkg/pkg.m |
diffstat | 1 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/pkg/pkg.m +++ b/scripts/pkg/pkg.m @@ -266,8 +266,9 @@ endif available_actions = {"list", "install", "uninstall", "load", ... - "unload", "prefix", "local_list", ... - "global_list", "rebuild", "build","describe"}; + "unload", "prefix", "local_list", ... + "global_list", "rebuild", "build", ... + "describe", "update"}; ## Handle input if (length (varargin) == 0 || ! iscellstr (varargin)) print_usage (); @@ -492,6 +493,21 @@ error ("you can request at most two outputs when calling 'pkg describe'"); endswitch + case "update" + if (nargout == 0) + installed_pkgs_lst = installed_packages (local_list, global_list); + for i = 1:length (installed_pkgs_lst) + installed_pkg_name = installed_pkgs_lst{i}.name; + installed_pkg_version = installed_pkgs_lst{i}.version; + forge_pkg_version = get_forge_pkg (installed_pkg_name); + if (compare_versions (forge_pkg_version, installed_pkg_version, ">")) + feval (@pkg, "install", "-forge", installed_pkg_name); + endif + endfor + else + error ("no output arguments available"); + endif + otherwise error ("you must specify a valid action for 'pkg'. See 'help pkg' for details"); endswitch