text
stringlengths
0
834k
no default search set, you will be prompted to use the search command to
find a package.
If describe is called with a numeric argument, that number is set as the
default package and the information about that package is returned. If
the number given doesn't exist, you will be prompted to use search to
find a package. Also, you can use describe to get descriptions of
several packages. For example:
describe 4-7
will return descriptions of packages 4 through 7 in the current search
request. You can also enter:
describe 3-4,10
to get information on packages 3, 4 and 10.
If you specify a URL as the argument to describe, PPM will describe the
package located at the URL. The URL must point to a PPD file. The URL
can also point to a PPD file on your computer.
When the describe command is given a name with a wildcard (such as ""*""
or ""?"") it executes the search command with the given argument. For
example, describe Tk* will return the name(s) of any packages that match
the search parameters.
See Also
properties
END
sub comp_describe {
my $o = shift;
my ($word, $line, $start) = @_;
# If no search results
my $n_results = $o->cache_sets('search');
my $n_current = $o->cache_set_current('search');
return ()
unless ($n_results and bounded(0, $n_current, $n_results - 1));
my @words = $o->line_parsed($line);
# If the previous word isn't a number or the command, stop.
return ()
if ($#words > 0 and
$words[$#words] !~ /^\d+/ and
$start == length($line) or
$#words > 1);
# This is the most optimistic list:
my @results = $o->cache_set('search');
my $npkgs = @results;
my @compls = (1 .. $npkgs);
# If the previous word is a number, return only other numbers:
return $o->completions($word, \@compls)
if $words[$#words] =~ /^\d+/;
# Either a number or the names of the packages
push @compls, map { $_->name } @results;
return $o->completions($word, \@compls);
}
sub run_describe {
my $o = shift;
my @args = @_;
# Check for options:
my $ppd;
{
local @ARGV = @args;
GetOptions(ppd => \$ppd, dump => \$ppd);
@args = @ARGV;
}
trace(1, ""PPM: describe @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;
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', @_);
}
my $dumper = sub {
my $o = shift;
my $pkg_obj = shift;
my $ppd = $pkg_obj->getppd($o->conf('target'))->result;
$o->page($ppd);
};
my $displayer = $ppd ? $dumper : \&describe_pkg;
# 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 describe -- "" .
""use 'search' to find a package.\n"");
return;