From 38488004c207508834543e02e991e6129669bc8c Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 30 Aug 2012 07:20:32 -0500 Subject: changes for REQUIRES in SBos for 14, and many cleanups, fixes, enhancements --- sboclean | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'sboclean') diff --git a/sboclean b/sboclean index 3e4da48..3154bd1 100755 --- a/sboclean +++ b/sboclean @@ -9,6 +9,7 @@ # date: Boomtime, the 6th day of Confusion in the YOLD 3178 # license: WTFPL +use 5.16.0; use SBO::Lib; use File::Basename; use Getopt::Std; @@ -19,7 +20,7 @@ use warnings FATAL => 'all'; my %config = %SBO::Lib::config; my $self = basename ($0); -sub show_usage { +sub show_usage () { print < =~ /^[Yy]/; } @@ -64,7 +64,7 @@ sub remove_stuff { } } -remove_stuff ($config{SBO_HOME} . '/distfiles') if $clean_dist eq 'TRUE'; -remove_stuff ('/tmp/SBo') if $clean_work eq 'TRUE'; +remove_stuff $config{SBO_HOME} .'/distfiles' if $clean_dist; +remove_stuff '/tmp/SBo' if $clean_work; exit 0; -- cgit v1.2.3 From 5ca399e0e9ab12063f15c4ab14443ba762877634 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 30 Aug 2012 14:03:49 -0500 Subject: bugfixes++ --- sboclean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sboclean') diff --git a/sboclean b/sboclean index 3154bd1..fd6f5c8 100755 --- a/sboclean +++ b/sboclean @@ -49,7 +49,7 @@ unless ($clean_dist || $clean_work) { sub remove_stuff ($) { exists $_[0] or script_error 'remove_stuff requires an argument'; - say "Nothing to do." and return 1 unless -d $_[0]; + -d $[0] or say "Nothing to do." and return 1; my $dir = shift; opendir (my $dh, $dir); FIRST: while (my $ls = readdir $dh) { -- cgit v1.2.3 From d55dbdf17977ed9b1dfd91c98a4a569960b851cd Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Fri, 31 Aug 2012 15:53:21 -0500 Subject: epic changes and fixes and much further testing --- sboclean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sboclean') diff --git a/sboclean b/sboclean index fd6f5c8..558272b 100755 --- a/sboclean +++ b/sboclean @@ -49,7 +49,7 @@ unless ($clean_dist || $clean_work) { sub remove_stuff ($) { exists $_[0] or script_error 'remove_stuff requires an argument'; - -d $[0] or say "Nothing to do." and return 1; + -d $_[0] or say "Nothing to do." and return 1; my $dir = shift; opendir (my $dh, $dir); FIRST: while (my $ls = readdir $dh) { -- cgit v1.2.3 From 6be3ef603fefc5d04b506b17cbad140790698042 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sat, 1 Sep 2012 02:14:32 -0500 Subject: more cleanups and fixes and such --- sboclean | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sboclean') diff --git a/sboclean b/sboclean index 558272b..d85b7bc 100755 --- a/sboclean +++ b/sboclean @@ -10,14 +10,14 @@ # license: WTFPL use 5.16.0; +use strict; +use warnings FATAL => 'all'; use SBO::Lib; use File::Basename; use Getopt::Std; use File::Path qw(remove_tree); -use strict; -use warnings FATAL => 'all'; -my %config = %SBO::Lib::config; +#my %config = %SBO::Lib::config; my $self = basename ($0); sub show_usage () { -- cgit v1.2.3 From 22e595ded4d1bc5bf6b8987ffcdd0f522d1a1bd0 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Sat, 1 Sep 2012 03:29:58 -0500 Subject: more cleanups --- sboclean | 1 - 1 file changed, 1 deletion(-) (limited to 'sboclean') diff --git a/sboclean b/sboclean index d85b7bc..b5588c7 100755 --- a/sboclean +++ b/sboclean @@ -17,7 +17,6 @@ use File::Basename; use Getopt::Std; use File::Path qw(remove_tree); -#my %config = %SBO::Lib::config; my $self = basename ($0); sub show_usage () { -- cgit v1.2.3 From 7ea05b95efb546b3540b807fb6979d7599b907ff Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Fri, 21 Sep 2012 07:00:41 -0500 Subject: sboclean converted to long options and fixes added from 0.8 --- sboclean | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'sboclean') diff --git a/sboclean b/sboclean index b5588c7..3244412 100755 --- a/sboclean +++ b/sboclean @@ -14,7 +14,7 @@ use strict; use warnings FATAL => 'all'; use SBO::Lib; use File::Basename; -use Getopt::Std; +use Getopt::Long qw(:config bundling); use File::Path qw(remove_tree); my $self = basename ($0); @@ -24,23 +24,32 @@ sub show_usage () { Usage: $self (options) [package] Options: - -h: this screen. - -v: version information. - -d: clean distfiles. - -w: clean working directories. - -i: be interactive. + -h|--help: + this screen. + -v|--version: + version information. + -d|--clean-dist: + clean distfiles. + -w|--clean-work: + clean working directories. + -i|--interactive: + be interactive. EOF } -my %options; -getopts ('hvdwi', \%options); +my ($help, $vers, $clean_dist, $clean_work, $interactive); -show_usage && exit 0 if exists $options{h}; -show_version && exit 0 if exists $options{v}; -my $clean_dist = exists $options{d} ? 1 : 0; -my $clean_work = exists $options{w} ? 1 : 0; -my $interactive = exists $options{i} ? 1 : 0; +GetOptions ( + 'help|h' => \$help, + 'version|v' => \$vers, + 'clean-dist|d' => \$clean_dist, + 'clean-work|w' => \$clean_work, + 'interactive|i' => \$interactive, +); + +show_usage && exit 0 if $help; +show_version && exit 0 if $vers; unless ($clean_dist || $clean_work) { show_usage, die "You must specify at least one of -d or -w.\n"; @@ -48,7 +57,7 @@ unless ($clean_dist || $clean_work) { sub remove_stuff ($) { exists $_[0] or script_error 'remove_stuff requires an argument'; - -d $_[0] or say "Nothing to do." and return 1; + -d $_[0] or say 'Nothing to do.' and return 1; my $dir = shift; opendir (my $dh, $dir); FIRST: while (my $ls = readdir $dh) { -- cgit v1.2.3 From 62405748ab1470aac11811167c001ce7cbeb040a Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 4 Oct 2012 05:05:52 -0500 Subject: removed 'date:' line from comments, cleanups for quote consistency, etc --- sboclean | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'sboclean') diff --git a/sboclean b/sboclean index 3244412..e9aedd8 100755 --- a/sboclean +++ b/sboclean @@ -6,7 +6,6 @@ # script to clean stuff left around from sbotools. # # author: Jacob Pipkin -# date: Boomtime, the 6th day of Confusion in the YOLD 3178 # license: WTFPL use 5.16.0; @@ -48,12 +47,11 @@ GetOptions ( 'interactive|i' => \$interactive, ); -show_usage && exit 0 if $help; -show_version && exit 0 if $vers; +show_usage and exit 0 if $help; +show_version and exit 0 if $vers; -unless ($clean_dist || $clean_work) { - show_usage, die "You must specify at least one of -d or -w.\n"; -} +show_usage, die "You must specify at least one of -d or -w.\n" unless + ($clean_dist || $clean_work); sub remove_stuff ($) { exists $_[0] or script_error 'remove_stuff requires an argument'; -- cgit v1.2.3