text stringlengths 0 834k |
|---|
@l = sort $response->result_l; |
$o->inform(""It looks like you have profiles on the server already.\n"") |
if @l; |
$o->print_pairs([1 .. @l], \@l, '. ', 1, ' '); |
$o->inform(""\n"") if @l; |
} |
require PPM::Sysinfo; |
(my $suggest = PPM::Sysinfo::hostname()) =~ s/\..*$//; |
$suggest ||= ""Default Profile""; |
my $profile_name = $o->prompt( |
""What profile name would you like? [$suggest] "", $suggest, @l |
); |
my $select_existing = grep { $profile_name eq $_ } $response->result_l |
if $response->ok; |
if ($select_existing) { |
$o->inform(""Selecting profile '$profile_name'...\n""); |
PPM::UI::profile_set($profile_name); |
$o->inform(<<END); |
You should probably run either 'profile save' or 'profile restore' to bring |
the profile in sync with your computer. |
END |
} |
elsif ($response->ok) { |
$o->inform(""Creating profile '$profile_name'...\n""); |
$o->run('profile', 'add', $profile_name); |
$o->inform(""Saving profile '$profile_name'...\n""); |
$o->run('profile', 'save'); |
$o->inform(<<END); |
Congratulations! PPM is now set up to track your profile. |
END |
} |
else { |
$o->warn($response->msg); |
$o->warn(<<END); |
You can still use PPM3, but profiles will not be enabled. To try setting up |
profiles again, enter 'set profile-track=1'. Or, you can set up profiles |
yourself using the 'profile add' command. |
END |
$o->run('unset', 'profile-track'); |
} |
} |
package main; |
use Getopt::Long; |
use Data::Dumper; |
$ENV{PERL_READLINE_NOWARN} = ""1""; |
$ENV{PERL_RL} = $^O eq 'MSWin32' ? ""0"" : ""Perl""; |
my ($pause, $input_file, $target); |
BEGIN { |
my ($shared_config_files, @fixpath, $gen_inst_key); |
Getopt::Long::Configure('pass_through'); |
$target = 'auto'; |
GetOptions( |
'file=s' => \$input_file, |
'shared' => \$shared_config_files, |
'target:s' => \$target, |
'fixpath=s' => \@fixpath, |
'generate-inst-key' => \$gen_inst_key, |
pause => \$pause, |
); |
Getopt::Long::Configure('no_pass_through'); |
if ($shared_config_files) { |
$ENV{PPM3_shared_config} = 1; |
} |
if (@fixpath) { |
PPM::UI::target_fix_paths(@fixpath); |
exit; |
} |
if ($gen_inst_key) { |
require PPM::Config; |
PPM::Config::load_config_file('instkey'); |
exit; |
} |
} |
# If we're being run from a file, tell Term::Shell about it: |
if ($input_file) { |
my $line = 0; |
open SCRIPT, $input_file or die ""$0: can't open $input_file: $!""; |
my $shell = PPMShell->new( |
term => ['PPM3', \*SCRIPT, \*STDOUT], |
target => $target, |
pager => 'none', |
); |
$shell->setmode('SCRIPT'); |
while (<SCRIPT>) { |
$line++; |
next if /^\s*#/ or /^\s*$/; |
my ($cmd, @args) = $shell->line_parsed($_); |
my $ret = $shell->run($cmd, @args); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.