text
stringlengths
0
834k
}
}
1;
}
sub alias_search { qw(s) }
#============================================================================
# tree
# tree # shows the dependency tree for the default/current pkg
# tree <\d+> # shows dep tree for numbered pkg in current search set
# tree <pkg> # shows dep tree for given package
# tree <url> # shows dep tree for package located at <url>
# tree <glob> # searches for matches
#============================================================================
sub smry_tree { ""shows package dependency tree"" }
sub help_tree { <<'END' }
tree -- Show Dependency Tree for Packages
Synopsis
tree Displays the dependency-tree of the current
or default package
tree <number> Displays the dependency-tree of the given <number>
tree <range> Displays a <range> of dependency-trees
tree <package name> Displays the dependency-tree of the named package
tree <url> Displays the dependency-tree for the
package at <url>
tree <glob pattern> Performs a new search using <glob pattern>
Description
The tree command is used to show the ""dependency tree"" of a given
package (additional packages that are required by the current package).
For example:
tree SOAP-lite
returns:
====================
SOAP-Lite 0.51
|__MIME-tools 5.316
| |__MailTools 1.15
| \__IO-stringy 1.216
|
\__MIME-Lite 2.105
====================
SOAP-Lite requires four other packages.
When tree is called without a <name> or <number> switch, the command
will return the dependency tree of the first package in the default
search result. If there is no default search, you will be requested to
use search to find a package.
END
sub comp_tree { goto &comp_describe }
sub run_tree {
my $o = shift;
my @args = @_;
trace(1, ""PPM: tree @args\n"");
# Check for anything that looks like a query. If it does, just
# send it to search() instead.
my $query = $o->raw_args || join ' ', @args;
$query ||= '';
if ($query and not PPM::UI::is_pkg($args[0]) and not parse_range($query)) {
$o->inform(""Wildcards detected; using 'search' instead...\n"");
return $o->run('search', @_);
}
# No Args: describes current index of current result set, or 1.
unless (@args) {
my @search_results = $o->cache_sets('search');
my $search_result_current = $o->cache_set_current('search');
unless (@search_results and
bounded(0, $search_result_current, $#search_results)) {
$o->warn(""No search results to show dependency tree for -- "" .
""use 'search' to find a package.\n"");
return;
}
else {
my @res = $o->cache_set('search');
my $npkgs = @res;
$o->inform(""$SEP\n"");
if ($o->cache_entry('search')) {
my $n = $o->cache_set_index('search') + 1;
$o->inform(""Package $n:\n"");
$o->tree_pkg($o->cache_entry('search'));
}
elsif (defined $o->cache_entry('search', 0)) {
$o->inform(""Package 1:\n"");
$o->tree_pkg($o->cache_entry('search', 0));
$o->cache_set_index('search', 0);
}
else {
$o->inform(""Search Results are empty -- use 'search' again.\n"");
}
$o->inform(""$SEP\n"");
}
}
# Args provided
else {