Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: test for command not found handler
- X-seq: zsh-workers 23680
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: PATCH: test for command not found handler
- Date: Fri, 13 Jul 2007 23:24:48 +0100
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Simple tests for the command not found handler.
Index: Test/C04funcdef.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/C04funcdef.ztst,v
retrieving revision 1.2
diff -u -r1.2 C04funcdef.ztst
--- Test/C04funcdef.ztst 19 Apr 2006 16:09:07 -0000 1.2
+++ Test/C04funcdef.ztst 13 Jul 2007 22:25:19 -0000
@@ -70,3 +70,32 @@
0:User-defined math functions, multiple interfaces
>4
>5
+
+ command_not_found_handler() {
+ print "Great News! I've handled the command:"
+ print "$1"
+ print "with arguments:"
+ print -l ${argv[2,-1]}
+ }
+ ACommandWhichHadBetterNotExistOnTheSystem and some "really useful" args
+0:Command not found handler, success
+>Great News! I've handled the command:
+>ACommandWhichHadBetterNotExistOnTheSystem
+>with arguments:
+>and
+>some
+>really useful
+>args
+
+ command_not_found_handler() {
+ print "Your command:" >&2
+ print "$1" >&2
+ print "has gone down the tubes. Sorry." >&2
+ return 1
+ }
+ ThisCommandDoesNotExistEither
+127:Command not found handler, failure
+?Your command:
+?ThisCommandDoesNotExistEither
+?has gone down the tubes. Sorry.
+?(eval):7: command not found: ThisCommandDoesNotExistEither
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author