zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: test for command not found handler
@ 2007-07-13 22:24 Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2007-07-13 22:24 UTC (permalink / raw)
  To: Zsh hackers list

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@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-07-13 22:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-13 22:24 PATCH: test for command not found handler Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).