text
stringlengths
0
834k
elsif (@path == 1) {
@compls = readline::rl_filename_list($word);
return $o->completions($word, \@compls);
}
elsif (matches($words[1], 's|ort-field')) {
@compls = sort_fields();
return $o->completions(lc($word), \@compls);
}
}
# Don't complete for anything else.
()
}
sub run_settings {
my $o = shift;
my @args = @_;
my $key = $args[0];
my $val = $args[1];
# To please the users of Bash, we'll allow 'set foo=bar' to work as well,
# since it's really easy to do:
if (defined $key and $key =~ /=/ and not defined $val) {
($key, $val) = split '=', $key;
}
trace(1, ""PPM: settings @args\n"");
my $unset = matches($o->{API}{cmd}{run}{name}, 'u|nset');
my @stuff = $o->completions($key, [$o->settings_getkeys()])
if $key;
my $fullkey = $stuff[0] if @stuff == 1;
if (defined $key and defined $val) {
# validate the key:
unless ($fullkey) {
$key = '' unless defined $key;
$o->warn(""Unknown or ambiguous setting '$key'. See 'help settings'.\n"");
return;
}
$o->conf($fullkey, $val, $unset);
}
elsif (defined $key) {
unless ($fullkey) {
$key = '' unless defined $key;
$o->warn(""Unknown or ambiguous setting '$key'. See 'help settings'.\n"");
return;
}
if ($unset) {
$o->conf($fullkey, '', $unset);
}
else {
my $val = $o->conf($fullkey);
$o->print_pairs([$fullkey], [$val]);
}
}
else {
my (@keys, @vals);
@keys = $o->settings_getkeys();
@vals = $o->settings_getvals();
my %k;
@k{@keys} = @vals;
@keys = sort keys %k;
@vals = map { $k{$_} } @keys;
$o->print_pairs(\@keys, \@vals);
}
}
sub alias_settings { qw(unset) }
sub help_help { <<'END' }
help -- General help, or help on specific commands.
Synopsis
help Lists available commands and help topics
help <command> Lists detailed help about a specific command
Description
The help command provides a brief description of the commands available
within PPM. For help on a specific command, enter help followed by the
command name. For example, enter help settings or help set for a
detailed description of the settings command.
There are some extra help topics built into PPM. They can be accessed
within the PPM environment as follows:
help ppm_migration
shows more details about the changes from previous versions of PPM
help quickstart
an easy-to-follow guide to getting started with PPM
help prompt
provides a detailed explanation about the PPM prompt
END
#============================================================================
# Version:
#============================================================================
sub smry_version { ""displays the PPM version ($VERSION)"" }
sub help_version { <<'END' }
version -- print the name and version of PPM.