[cage] Unbreak the build
[parrot.git] / tools / dev / search-ops.pl
blob8dd65b1e6863bfc8c80a4db4c635fc6267fd8252
1 # perl
2 # Copyright (C) 2008, Parrot Foundation.
3 # $Id$
4 use strict;
5 use warnings;
6 use Carp;
7 use Getopt::Long ();
8 use lib qw( ./lib );
9 use Parrot::SearchOps qw(
10 search_all_ops_files
11 usage
12 help
15 my ($help, $all);
16 Getopt::Long::GetOptions(
17 "help" => \$help,
18 "all" => \$all,
19 ) or exit 1;
21 if ($help) {
22 help();
23 exit 0;
26 croak "You may search for only 1 ops code at a time: $!"
27 if @ARGV > 1;
28 unless ($all or $ARGV[0]) {
29 usage();
30 exit 0;
33 my $pattern = $all ? q{} : $ARGV[0];
34 my $wrap_width = 70;
35 my $opsdir = q{src/ops};
37 my $total_identified = search_all_ops_files(
38 $pattern, $wrap_width, $opsdir
41 print "No matches were found\n" unless $total_identified;
42 exit 0;
44 =head1 NAME
46 tools/dev/search-ops.pl - Get descriptions of ops codes
48 =head1 USAGE
50 From the top-level Parrot directory,
52 perl tools/dev/search-ops.pl ops_pattern
54 For help,
56 perl tools/dev/search-ops.pl --help
58 To display all ops codes,
60 perl tools/dev/search-ops.pl --all
62 =head1 AUTHOR
64 James E Keenan, adapting Python program written by Bernhard Schmalhofer.
66 =cut
68 # Local Variables:
69 # mode: cperl
70 # cperl-indent-level: 4
71 # fill-column: 100
72 # End:
73 # vim: expandtab shiftwidth=4: