Changeset fc8707b


Ignore:
Timestamp:
Oct 2, 2010, 9:20:02 PM (14 years ago)
Author:
Jessica B. Hamrick <jhamrick@…>
Branches:
master, debian, mac, no-cups
Children:
a5cf43b
Parents:
6b7441a
git-author:
Jessica B. Hamrick <jhamrick@…> (10/02/10 21:20:02)
git-committer:
Jessica B. Hamrick <jhamrick@…> (10/02/10 21:20:02)
Message:
Add '-hhelp' flags to all the client scripts
Add a '-ddryrun' option to gbr, to just list what would be done instead of doing it
Location:
client/bin
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • client/bin/gbq

    r6b7441a rfc8707b  
    1111use Getopt::Long;
    1212
    13 my $usage = "Usage: gbq [-q QUEUE]\n";
     13# usage
     14my $usage = <<USAGE;
     15Usage: gbq [options] [-q QUEUE]
    1416
     17        -q, --queue             Specify a queue other than the default
     18        -h, --help              Print this message
     19USAGE
     20
     21# initialize the variables for the options
    1522my $q = "";
    16 GetOptions ('q|queue=s' => \$q);
     23my $help = 0;
     24
     25# parse the options
     26GetOptions ('q|queue=s' => \$q,
     27            'h|help' => \$help);
     28
     29# if the -h flag was passed, then print the usage and exit
     30if ($help) {
     31    print $usage;
     32    exit 0;
     33}
    1734
    1835# if the -q option is not specified, then assume we're using the
  • client/bin/gbr

    r6b7441a rfc8707b  
    1212use Image::ExifTool qw(ImageInfo);
    1313
    14 my $usage = "Usage: gbr QUEUE FILES\n";
     14# the usage for this script
     15my $usage = <<USAGE;
     16Usage: gbr [options] [-q QUEUE] FILES
    1517
     18        -q, --queue             Specify a queue other than the default
     19        -d, --dryrun            Just list what would be done
     20        -h, --help              Print this message
     21USAGE
     22
     23# initialize the variables for the options
    1624my $q = "";
    17 GetOptions ('q|queue=s' => \$q);
     25my $dryrun = 0;
     26my $help = 0;
     27
     28# parse the options
     29GetOptions ('q|queue=s' => \$q,
     30            'd|dryrun' => \$dryrun,
     31            'h|help' => \$help);
     32
     33# if the -h flag was passed, then print the usage and exit
     34if ($help) {
     35    print $usage;
     36    exit 0;
     37}
    1838
    1939my @files = @ARGV[0 .. $#ARGV];
     
    6181# if $printer is not defined, then throw an error
    6282unless( $printer){
    63     print "Cannot access queue $q...do you have network connectivity and permission to view the queue?\n";
     83    print "Cannot access queue $q... do you have network connectivity and permission to view the queue?\n";
    6484    exit 1;
    6585}
     
    100120    }
    101121
    102     # send the print job, given the file and the job title
    103     $jobid = $printer->printFile($file, $title);
    104    
    105     # if the printFile command returned a job id, then print that out
    106     # for the user to see
    107     if ($jobid) {
    108         print "Sent job '$title' (id $jobid)\n";
    109     }
     122    # unless it's a dry run, send the print job, given the file and
     123    # the job title
     124    unless ($dryrun) {
     125        $jobid = $printer->printFile($file, $title);
    110126
    111     # otherwise, let them know that an error occurred
    112     else {
    113         print "Error sending job '$title'\n";
    114     }
     127        # if the printFile command returned a job id, then print that out
     128        # for the user to see
     129        if ($jobid) {
     130            print "Sent job '$title' (id $jobid)\n";
     131        }
     132
     133        # otherwise, let them know that an error occurred
     134        else {
     135            print "Error sending job '$title'\n";
     136        }
     137
     138    # otherwise, just print what we would do
     139    } else {
     140        print "Would send file '$file' with title '$title'\n";
     141    }   
    115142}
  • client/bin/gbrm

    r6b7441a rfc8707b  
    1111use Getopt::Long;
    1212
    13 my $usage = "Usage: gbq [-q QUEUE] ID\n";
     13# usage
     14my $usage = <<USAGE;
     15Usage: gbq [options] [-q QUEUE] ID
     16
     17        -q, --queue             Specify a queue other than the default
     18        -h, --help              Print this message
     19USAGE
     20
     21# initialize the variables for the options
    1422my $q = "";
    15 GetOptions ('q|queue=s' => \$q);
     23my $help = 0;
     24
     25# parse the options
     26GetOptions ('q|queue=s' => \$q,
     27            'h|help', => \$help);
     28
     29# if the -h flag was passed, then print the usage and exit
     30if ($help) {
     31    print $usage;
     32    exit 0;
     33}
    1634
    1735my @ids = @ARGV[0 .. $#ARGV];
     
    1937# if the -q option is not specified, then assume we're using the
    2038# default queue
    21 if (!$q){
     39if (!$q) {
    2240    $q = "DEFAULT";
    2341}
  • client/bin/gutenbach-client-config

    r6b7441a rfc8707b  
    1010# the usage for the program
    1111my $usage = <<USAGE;
    12 Usage: gutenbach-client-config [-l|--list|-a|--add|-d|--delete] [QUEUE] [--host=HOST]
     12Usage: gutenbach-client-config [options]
    1313
    1414        -l, --list              List available queues
     
    1616        -d, --delete QUEUE      Delete a queue
    1717        -s, --set-default QUEUE Set the default queue
    18         -h, --host HOST         Hostname for the queue
     18        -h, --host HOST         Hostname for the queue (must be used with -a)
     19        -H, --help              Print this message
    1920USAGE
    2021
     
    2526my $host = "";
    2627my $default = "";
     28my $help = 0;
    2729
    2830# get the options from the command line
     
    3133            'a|add=s' => \$add,
    3234            'd|delete=s' => \$delete,
    33             'h|host=s' => \$host);
     35            'h|host=s' => \$host,
     36            'H|help' => \$help);
     37
     38# if the -H flag was passed, then print the usage and exit
     39if ($help) {
     40    print $usage;
     41    exit 0;
     42}
    3443
    3544# set the path where the configuration files live
Note: See TracChangeset for help on using the changeset viewer.