changeset 27897:c8a44a4e4fe7

Add dependency information to output of "pkg describe" (patch #9880). * describe.m: Add new field "depends" to pkg_desc_list structure. Call print_package_description() with additional input pkg_desc_list.depends. * describe.m (print_package_description): Change function prototype to accept new input with dependency information. Format and print output on dependencies.
author Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
date Fri, 20 Dec 2019 07:04:31 +0100
parents 5701a3716577
children 4d6d21839dfd
files scripts/pkg/private/describe.m
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/pkg/private/describe.m	Thu Jan 02 10:04:37 2020 -0800
+++ b/scripts/pkg/private/describe.m	Fri Dec 20 07:04:31 2019 +0100
@@ -56,6 +56,7 @@
       pkg_desc_list{name_pos}.name = installed_pkgs_lst{i}.name;
       pkg_desc_list{name_pos}.version = installed_pkgs_lst{i}.version;
       pkg_desc_list{name_pos}.description = installed_pkgs_lst{i}.description;
+      pkg_desc_list{name_pos}.depends = installed_pkgs_lst{i}.depends;
       pkg_desc_list{name_pos}.provides = parse_pkg_idx (installed_pkgs_lst{i}.dir);
 
     endif
@@ -78,6 +79,7 @@
                                  pkg_desc_list{i}.version,
                                  pkg_desc_list{i}.provides,
                                  pkg_desc_list{i}.description,
+                                 pkg_desc_list{i}.depends,
                                  flag{i}, verbose);
     endfor
   endif
@@ -140,11 +142,15 @@
 
 
 function print_package_description (pkg_name, pkg_ver, pkg_idx_struct,
-                                    pkg_desc, status, verbose)
+                                    pkg_desc, pkg_deps, status, verbose)
 
   printf ("---\nPackage name:\n\t%s\n", pkg_name);
   printf ("Version:\n\t%s\n", pkg_ver);
   printf ("Short description:\n\t%s\n", pkg_desc);
+  pkg_deps = cellfun (@(d) sprintf ("%s %s %s", struct2cell (d){:}), pkg_deps,
+                      "UniformOutput", false);
+  pkg_deps = strjoin (pkg_deps, "\n\t");
+  printf ("Depends on:\n\t%s\n", pkg_deps);
   printf ("Status:\n\t%s\n", status);
   if (verbose)
     printf ("---\nProvides:\n");