Update of /cvsroot/tmda/tmda/bin
In directory usw-pr-cvs1:/tmp/cvs-serv4439/bin
Modified Files:
ChangeLog tmda-pending
Log Message:
Allow messages to be specified on standard input instead of the
command line by using `-' instead of a message list.
Sample usage:
tmda-pending -bT | grep 'foobar' | awk '{print $1}' | \
tmda-pending -br -
Patch contributed by Michael S. Fischer in
<[EMAIL PROTECTED]> on tmda-workers.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/ChangeLog,v
retrieving revision 1.237
retrieving revision 1.238
diff -u -r1.237 -r1.238
--- ChangeLog 18 Oct 2002 22:36:16 -0000 1.237
+++ ChangeLog 29 Oct 2002 19:40:51 -0000 1.238
@@ -1,3 +1,9 @@
+2002-10-29 Jason R. Mastaler <[EMAIL PROTECTED]>
+
+ * tmda-pending (main): Allow messages to be specified on standard
+ input instead of the command line by using `-' instead of a
+ message list (patch by Michael S. Fischer).
+
2002-10-18 Jason R. Mastaler <[EMAIL PROTECTED]>
* tmda-rfilter (autorespond_to_sender): Check for Auto-Submitted:.
Index: tmda-pending
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-pending,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- tmda-pending 30 Sep 2002 23:45:54 -0000 1.31
+++ tmda-pending 29 Oct 2002 19:40:52 -0000 1.32
@@ -21,7 +21,7 @@
"""Pending queue manipulation tool.
-Usage: %(program)s [OPTIONS] [messages ... ]
+Usage: %(program)s [OPTIONS] [messages ... | - ]
Where:
-c <file>
@@ -116,9 +116,10 @@
--help
Print this help message and exit.
- messages
- If one or more messages are provided, operate just on them.
- Otherwise, operate on all messages in the pending queue.
+ messages | -
+ If one or more messages are provided, operate just on them.
+ If `-' is specified, operate on a list of messages provided by
+ standard input. Otherwise, operate on all messages in the pending queue.
Examples:
@@ -131,6 +132,9 @@
(immediately release these messages from the pending queue)
%(program)s -b -r 1012182077.5803.msg 1012939546.7870.msg
+ (immediately release any messages with `foobar' in them)
+ %(program)s -b -T | grep foobar | awk '{print $1}' | %(program)s -b -r -
+
(immediately delete all messages from the pending queue)
%(program)s -b -d
@@ -314,7 +318,20 @@
os.chdir(os.path.join(Defaults.DATADIR, 'pending'))
msgs = args
- if not msgs:
+
+ # Replace any `-' in the message list with those messages provided
+ # via standard input. (Since it's pointless to call it twice,
+ # it's safe to remove any subsequent occurrences in the list after
+ # processing.)
+ wantedstdin = 0
+ for msg in msgs:
+ if msg == '-':
+ wantedstdin = 1
+ for line in sys.stdin.readlines():
+ msgs.append(line.strip())
+ msgs.remove('-')
+
+ if not msgs and not wantedstdin:
msgs = glob.glob('*.*.msg')
msgs.sort()
_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs