rename --only to --reader
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 3 Aug 2010 10:33:19 +0000 (12:33 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 3 Aug 2010 10:33:19 +0000 (12:33 +0200)
This is consistant with other scripts

scripts/program.pl

index f15dfa8..d7d5629 100755 (executable)
@@ -9,23 +9,23 @@ use lib 'lib';
 use RFID::Biblio::Readers;
 use RFID::Biblio::RFID501;
 
-my $only;
+my $reader;
 
 GetOptions(
-       'only=s', => \$only,
+       'reader=s', => \$reader,
 ) || die $!;
 
 my ( $sid, $content ) =  @ARGV;
-die "usage: $0 E0_RFID_SID content\n" unless $sid && $content;
+die "usage: $0 [--reader regex_filter] [--afi 214] E0_RFID_SID [barcode]\n" unless $sid && ( $content | $afi );
 
-my @rfid = RFID::Biblio::Readers->available( $only );
+my @rfid = RFID::Biblio::Readers->available( $reader );
 
 foreach my $rfid ( @rfid ) {
        my $visible = $rfid->scan;
        foreach my $tag ( keys %$visible ) {
                next unless $tag eq $sid;
                warn "PROGRAM $tag with $content\n";
-               $rfid->write_blocks( $tag, RFID::Biblio::RFID501->from_hash({ content => $content }) );
+               $rfid->write_blocks( $tag => RFID::Biblio::RFID501->from_hash({ content => $content }) );
        }
 }