[rt-users] rt cli comment, merge, link not working, patch for default query and order
Angus D Madden
ii at took.ekilat.com
Mon Jan 19 12:03:49 EST 2004
Hello,
I am using rt 3.0.8 and am trying to make the command-line work to my
liking. I have added support for a default query and order for `rt ls'
and both can be specified in the .rtrc or in the environment. I have
attached the patch against version 3.0.8.
The cli tool will make my life much better, however, I am still having
problems with the comment, merge and link commands. It appears that
REST/1.0/dhandler is intercepting requests for
REST/1.0/ticket/{merge,comment,link}/id and sending them to
REST/1.0/Forms/ticket/default
Is this the case or do I have a local configuration problem? Any hints?
g
-------------- next part --------------
--- /tmp/rt.orig Mon Jan 19 11:45:52 2004
+++ /tmp/rt.new Mon Jan 19 11:51:48 2004
@@ -46,6 +46,8 @@
user => eval{(getpwuid($<))[0]} || $ENV{USER} || $ENV{USERNAME},
passwd => undef,
server => 'http://localhost/rt/',
+ query => undef,
+ orderby => undef,
),
config_from_file($ENV{RTCONFIG} || ".rtrc"),
config_from_env()
@@ -167,6 +169,8 @@
sub list {
my ($q, $type, %data, $orderby);
+ $orderby = $config{orderby};
+
my $bad = 0;
while (@ARGV) {
@@ -200,7 +204,12 @@
$bad = 1; last;
}
}
-
+
+ if (!defined $q)
+ {
+ $q = $config{query} ;
+ }
+
$type ||= "ticket";
unless ($type && defined $q) {
my $item = $type ? "query string" : "object type";
@@ -733,7 +742,7 @@
my ($head, $text) = split /\n\n/, $res->content, 2;
my ($status, @headers) = split /\n/, $head;
- $text =~ s/\n*$/\n/;
+ $text =~ s/\n*\\$/\n/;
# "RT/3.0.1 401 Credentials required"
if ($status !~ m#^RT/\d+(?:\.\d+)+(?:-?\w+)? (\d+) ([\w\s]+)$#) {
@@ -1061,7 +1070,7 @@
sub config_from_env {
my %env;
- foreach my $k ("DEBUG", "USER", "PASSWD", "SERVER") {
+ foreach my $k ("DEBUG", "USER", "PASSWD", "SERVER", "QUERY", "ORDERBY") {
if (exists $ENV{"RT$k"}) {
$env{lc $k} = $ENV{"RT$k"};
}
@@ -1112,7 +1121,7 @@
chomp;
next if (/^#/ || /^\s*$/);
- if (/^(user|passwd|server)\s+([^ ]+)$/) {
+ if (/^(user|passwd|server|query|orderby)\s+(.*)\s?$/) {
$cfg{$1} = $2;
}
else {
@@ -1343,6 +1352,8 @@
- server <URL> URL to RT server.
- user <username> RT username.
- passwd <passwd> RT user's password.
+ - query <RT Query> Default RT Query for list action
+ - orderby <order> Default RT order for list action
Blank and #-commented lines are ignored.
@@ -1357,6 +1368,8 @@
- RTDEBUG Numeric debug level. (Set to 3 for full logs.)
- RTCONFIG Specifies a name other than ".rtrc" for the
configuration file.
+ - RTQUERY Default RT Query for rt list
+ - RTORDERBY Default order for rt list
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20040119/6ec9f972/attachment.sig>
More information about the rt-users
mailing list