Skip to content

Instantly share code, notes, and snippets.

@earnhardt3rd
Created June 19, 2023 14:03
Show Gist options
  • Select an option

  • Save earnhardt3rd/6721ca60c92d7b14ea46ee1fd0708a5b to your computer and use it in GitHub Desktop.

Select an option

Save earnhardt3rd/6721ca60c92d7b14ea46ee1fd0708a5b to your computer and use it in GitHub Desktop.
require 'getopts.pl';
Getopts('m:d:t');
my $MODE = uc($opt_m) || "";
my $DEBUG = $opt_d || 0;
if (defined $opt_t) { my %TEST = &_RFC_REVIEW();}
1;
sub _RFC_REVIEW {
my $REVIEW_PAK = shift || "";
my $REVIEW_TYP = shift || "";
my $PAK_FILENM = shift || "";
my $REP_FOLDER = shift || "FALSE";
if ($REVIEW_PAK eq "") {return;}
if (! -f $PAK_FILENM) {
my $usrCmt = &getComment(""," Enter Package $REVIEW_PAK $REVIEW_TYP");
if ($usrCmt ne "NO COMMENTS PROVIDED") {
open (SFH,"> $PAK_FILENM");
print SFH "$usrCmt\n";
close(SFH);
}
} else {
open(SFH,"< $PAK_FILENM");
my $reviewText="";
while (<SFH>) {
my $line = $_;
chomp($line);
next if ($line =~ /#/);
next if ($line eq "");
$reviewText.="$line\n";
}
close(SFH);
if ($reviewText eq "") {
my $usrCmt = &getComment(""," Enter Package $REVIEW_PAK $REVIEW_TYP");
open (SFH,"> $PAK_FILENM");
if ($usrCmt =~ /NO COMMENTS PROVIDED/) {
print SFH "$PACKAGE_SCOPE\n";
} else {
print SFH "$usrCmt\n";
}
close(SFH);
} else {
print "\n";
print " ** CURRENT $REVIEW_TYP FOR PACKAGE ( $REVIEW_PAK ) **\n";
&displayMessageInBox($reviewText);
my $sans = &Ask("Do you want to update $REVIEW_TYP","Keep","Append","Replace","Exit");
if ($sans eq "Exit") {&_EXIT_CLEAN();}
if ($sans eq "Append") {
my $ausrCmt = &getComment(""," Append Package $REVIEW_PAK $REVIEW_TYP");
open (SFH,">> $PAK_FILENM");
if ($ausrCmt =~ /NO COMMENTS PROVIDED/) {
print " You did not provide any comments! SKIPPED Append\n";
} else {
print SFH "$ausrCmt\n";
}
close(SFH);
}
if ($sans eq "Replace") {
my $rusrCmt = &getComment(""," Replace Package $REVIEW_PAK $REVIEW_TYP");
if ($rusrCmt =~ /NO COMMENTS PROVIDED/) {
print " You did not provide any comments! SKIPPED Replace\n";
} else {
my $TMP_FILE = $PAK_FILENM . "-tmp";
open (SFH,"> $TMP_FILE");
print SFH "$rusrCmt\n";
close(SFH);
&replaceFileIfDifferent($PAK_FILENM,$TMP_FILE,$REP_FOLDER);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment