text stringlengths 0 834k |
|---|
return unless $ok->ok; |
} |
my @profiles = dictsort $ok->result_l; |
$ok = PPM::UI::profile_get(); |
unless ($ok->is_success) { |
$o->warn($ok->msg); |
return unless $ok->ok; |
} |
my $profile = $ok->result; |
my $which = find_index($profile, 0, @profiles); |
if ($which < 0 and @profiles) { |
$profile = $profiles[0]; |
PPM::UI::profile_set($profile); |
} |
if (@args) { |
# Switch to profile N: |
if ($args[0] =~ /^\d+$/) { |
my $num = $args[0]; |
if (bounded(1, $num, scalar @profiles)) { |
my $profile = $profiles[$num-1]; |
PPM::UI::profile_set($profile); |
} |
else { |
$o->warn(""No such profile number '$num'.\n""); |
return; |
} |
} |
# Describe profile N: |
elsif (matches($args[0], ""des|cribe"")) { |
my $num = $args[1] =~ /^\d+$/ ? $args[1] : |
do { |
my $n = find_index($args[1], 1, @profiles); |
if ($n < 1) { |
$o->warn(""No such profile '$args[1]'.\n""); |
return; |
} |
$n; |
} if defined $args[1]; |
my $prof; |
if (defined $num and $num =~ /^\d+$/) { |
if (bounded(1, $num, scalar @profiles)) { |
$prof = $profiles[$num - 1]; |
} |
else { |
$o->warn(""No such profile number '$num'.\n""); |
return; |
} |
} |
elsif (defined $num) { |
$o->warn(""Argument to '$args[0]' must be numeric; see 'help profile'.\n""); |
return; |
} |
else { |
$prof = $profile; |
} |
my $res = PPM::UI::profile_info($prof); |
$o->warn($res->msg) and return unless $res->ok; |
my @res = $res->result_l; |
{ |
my ($pkg, $version, $target); |
my $picture = <<'END'; |
[[[[[[[[[[[[[[[[[[[ [[[[[[[[[[[ [[[[[[[[[[[[[[[[[[[[[[ |
END |
($pkg, $version, $target) = qw(PACKAGE VERSION TARGET); |
my $text = ''; |
$text .= form($picture, $pkg, $version, $target) |
if @res; |
for my $entity (@res) { |
($pkg, $version, $target) = @$entity; |
$version = ""[$version]""; |
$text .= form($picture, $pkg, $version, $target); |
} |
if (@res) { |
$o->inform(""Describing Profile '$prof':\n""); |
} |
else { |
$o->inform(""Profile '$prof' is empty.\n""); |
} |
$o->page($text); |
} |
return 1; |
} |
# Add a profile ""name"": |
elsif (matches($args[0], ""a|dd"")) { |
my $name = $args[1]; |
if ($name) { |
# Note: do some heavy-duty error-checking; XXX |
PPM::UI::profile_add($name); |
PPM::UI::profile_save($name) |
if $o->conf('profile-track'); |
PPM::UI::profile_set($name) |
unless $which >= 0; |
@profiles = PPM::UI::profile_list()->result_l; |
} |
else { |
$o->warn(""Invalid use of 'add' command; see 'help profile'.\n""); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.