build(utils/develop-status.pl): Introduced command line options.

This commit is contained in:
Stephan Barth 2024-10-24 02:09:50 +02:00
parent ba67e1323e
commit 30dfc142bd

View File

@ -10,6 +10,35 @@ if($ENV{PWD}=~m#/utils$#) {
chdir("..");
}
my %listOutside=(
running=>1,
_default=>0, # everything for which no key exists
);
for my $arg(@ARGV) {
if('-a' eq $arg) {
%listOutside=(_default=>1);
next
}
if('-h' eq $arg) {
usage()
}
usage("Invalid argument: '$arg'");
}
sub usage {
my $msg = shift;
print "$msg\n\n" if $msg;
print "$0 [args]
-h display this help text
-a show all containers with fitting names even when without containerfile
";
exit 1 if $msg;
exit 0
}
print "== Development status ==\n";
# Find out container status
@ -66,7 +95,8 @@ for my $k(sort {
$cont{$a}{name} cmp $cont{$b}{name}
} grep { !$cont{$_}{used} } keys %cont) {
my $c = $cont{$k};
print "Fradrive container outside develop file: ($c->{state}) $c->{name} $c->{id}\n"
my $show = $listOutside{$c->{state}} // $listOutside{_default};
print "Fradrive container outside develop file: ($c->{state}) $c->{name} $c->{id}\n" if $show
}
exit 0;