Changeset 7cdd65d for client


Ignore:
Timestamp:
Aug 14, 2010, 9:30:39 PM (14 years ago)
Author:
Kyle Brogle <broglek@…>
Branches:
master, debian, mac, no-cups
Children:
618236b, 9dee329
Parents:
55b24d1
git-author:
Kyle Brogle <broglek@…> (08/14/10 21:30:39)
git-committer:
Kyle Brogle <broglek@…> (08/14/10 21:30:39)
Message:

Implemented default queue in client scripts.
Queue argument now optional for gb{r,rm,q}, and also takes form of -q QUEUE
now.

gutenbach-client-config -sset-default QUEUE will set default queue

Updated manpages accordingly.

Location:
client/bin
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • client/bin/gbq

    r9fdf4a1 r7cdd65d  
    88use Net::CUPS;
    99use Net::CUPS::Destination;
     10use Getopt::Long;
    1011
    11 my $usage = "Usage: gbq QUEUE\n";
     12my $usage = "Usage: gbq [-q QUEUE]\n";
    1213
    13 my $q = $ARGV[0];
     14my $q = "";
     15GetOptions ('q|queue=s' => \$q);
    1416
    1517if (!$q) {
    16     print $usage;
    17     exit 1
     18    $q = "DEFAULT";
    1819}
    1920
  • client/bin/gbq.1

    r2c76f34 r7cdd65d  
    44.SH SYNOPSIS
    55.B gbq
    6 \fIQUEUE\fR
     6[-q \fIQUEUE\fR]
    77.SH DESCRIPTION
    88Uses the perl Net::CUPS library to access a remote queue and display
     
    1010Gutenbach queue must have previously been added with
    1111.B gutenbach-client-config
    12 so that gbq knows which host to use.
     12so that gbq knows which host to use.  If no queue is specified,
     13.B gbq
     14will try to use the default queue, if one is configured.
    1315.SH SEE ALSO
    1416gbr(1), gbrm(1), gutenbach-client-config(1)
  • client/bin/gbr

    r9fdf4a1 r7cdd65d  
    88use Net::CUPS;
    99use Net::CUPS::Destination;
     10use Getopt::Long;
    1011use Image::ExifTool qw(ImageInfo);
    1112
    1213my $usage = "Usage: gbr QUEUE FILES\n";
    1314
    14 my $q = $ARGV[0];
    15 my @files = @ARGV[1 .. $#ARGV];
     15my $q = "";
     16GetOptions ('q|queue=s' => \$q);
    1617
    17 if (!$q or !@files) {
     18my @files = @ARGV[0 .. $#ARGV];
     19
     20if (!$q){
     21    $q = "DEFAULT";
     22}
     23if (!@files) {
    1824    print $usage;
    1925    exit 1
  • client/bin/gbr.1

    r38388ac r7cdd65d  
    44.SH SYNOPSIS
    55.B gbr
    6 \fIQUEUE\fR \fIFILES\fR
     6[-q \fIQUEUE\fR] \fIFILES\fR
    77.SH DESCRIPTION
    88Prints files to a Gutenbach queue, given the queue name and the path
     
    1515must have previously been added with
    1616.B gutenbach-client-config
    17 so that gbr knows which host to use.
     17so that gbr knows which host to use.  If no queue is specified,
     18.B gbr
     19will try to use the default queue, if one is configured.
    1820.SH SEE ALSO
    1921gbq(1), gbrm(1), gutenbach-client-config(1)
  • client/bin/gbrm

    r335786f r7cdd65d  
    88use Net::CUPS;
    99use Net::CUPS::Destination;
     10use Getopt::Long;
    1011
    11 my $usage = "Usage: gbq QUEUE ID\n";
     12my $usage = "Usage: gbq [-q QUEUE] ID\n";
     13my $q = "";
     14GetOptions ('q|queue=s' => \$q);
    1215
    13 my $q = $ARGV[0];
    14 my @ids = @ARGV[1 .. $#ARGV];
     16my @ids = @ARGV[0 .. $#ARGV];
    1517
    16 if (!$q or !@ids) {
     18if (!$q){
     19    $q = "DEFAULT";
     20}
     21if (!@ids) {
    1722    print $usage;
    1823    exit 1
    1924}
     25
    2026
    2127my $configpath = "$ENV{'HOME'}/.gutenbach/$q";
  • client/bin/gbrm.1

    rd768767 r7cdd65d  
    44.SH SYNOPSIS
    55.B gbrm
    6 \fIQUEUE\fR [all|current|\fIID\fR]
     6[-q \fIQUEUE\fR] [all|current|\fIID\fR]
    77.SH DESCRIPTION
    88Removes a single job from a Gutenbach queue, given the job id, which
     
    1919queue.  The queue must have previously been added with
    2020.B gutenbach-client-config
    21 so that gbrm knows which host to use.
     21so that gbrm knows which host to use.  If no queue is specified,
     22.B gbr
     23will try to use the default queue, if one is configured.
    2224.SH SEE ALSO
    2325gbr(1), gbq(1), gutenbach-client-config(1)
  • client/bin/gutenbach-client-config

    r30beeab r7cdd65d  
    1919my $delete = "";
    2020my $host = "";
     21my $default = "";
    2122
    2223GetOptions ('l|list' => \$list,
     24            's|set-default=s' => \$default,
    2325            'a|add=s' => \$add,
    2426            'd|delete=s' => \$delete,
     
    3032    mkdir "$configpath";
    3133}
     34#set given queue to default
     35if($default and !$add and !$delete and !$list) {
     36    unless(-e "$configpath/$default") {
     37        print "Error: queue '$default' doesn't exist yet...you should add it first.\n";
     38        exit 1;
     39    }
     40    if( -e "$configpath/DEFAULT"){
     41        unlink("$configpath/DEFAULT") or die "Couldn't remove config file '$configpath/DEFAULT'";
     42    }
     43    my $symlink_exists = eval { symlink("",""); 1 };
     44    if ($symlink_exists){
     45        symlink("$configpath/$default","$configpath/DEFAULT");
     46        print "Changed default queue to $default.\n";
     47    }
     48    else
     49    {
     50        print "Error creating symlink to $configpath/$default";
     51        exit 1;
     52    }
     53}
     54   
     55       
    3256
    3357# list the existing queues
    34 if ($list and !$add and !$delete) {
     58elsif ($list and !$add and !$delete and !$default) {
    3559    my @queues = glob("$configpath/*") or die "Couldn't find configuration files at '$configpath'";
    3660
  • client/bin/gutenbach-client-config.1

    r2c76f34 r7cdd65d  
    44.SH SYNOPSIS
    55.B gutenbach-client-config
    6 [-l|--list|-a|--add|-d|--delete] [\fIQUEUE\fR] [--host \fIHOST\fR]
     6[-l|--list|-a|--add|-d|--delete|-s|--set-default] [\fIQUEUE\fR] [--host \fIHOST\fR]
    77.SH DESCRIPTION
    88Provides options to add, remove, or list remote Gutenbach queues.  The
     
    3434\fB\-h\fR, \fB\-\-host\fR HOST
    3535Hostname for the queue
     36.TP
     37\fB\-s\fR, \fB\-\-set\-default\fR QUEUE
     38Set the default queue
    3639.SH SEE ALSO
    3740gbr(1), gbrm(1), gbq(1)
Note: See TracChangeset for help on using the changeset viewer.