Tests of CLI Plugin
This page provides a set of test cases for the CLI Plugin and also serves as an example of its use.
Basic Shell Script
Wiki text:
<cli> user@host:~/somedir $ ls conf lang README screen.gif ui info.txt manager.dat renderer.php syntax.php user@host:~/somedir $ wc info.txt # count words in info.txt 55 108 1032 info.txt user@host:~/somedir $ </cli>
Rendered result:
user@host:~/somedir $ ls conf lang README screen.gif ui info.txt manager.dat renderer.php syntax.php user@host:~/somedir $ wc info.txt # count words in info.txt 55 108 1032 info.txt user@host:~/somedir $
Shell Script with Comments
user@host:~/somedir $ ls # List current directory conf lang README screen,gif ui info.txt manager.dat renderer.php syntax.php user@host:~/somedir $
Root Shell Script with Comments
This (default shell comment character):
<cli prompt="#"> root@host:~user/somedir # ls # List current directory conf lang README screen,gif ui info.txt manager.dat renderer.php syntax.php root@host:~user/somedir # </cli>
renders as this:
root@host:~user/somedir # ls # List current directory conf lang README screen,gif ui info.txt manager.dat renderer.php syntax.php root@host:~user/somedir #
This is also valid:
<cli prompt="# " comment="#"> root@host:~user/somedir # ls # List current directory conf lang README screen,gif ui info.txt manager.dat renderer.php syntax.php root@host:~user/somedir # </cli>
root@host:~user/somedir # ls # List current directory conf lang README screen,gif ui info.txt manager.dat renderer.php syntax.php root@host:~user/somedir #
Example with a continuation prompt:
<cli prompt="$ " continue="> " comment="#"> user@host:~/somedir $ ls \ > # List directory file1 file2 </cli>
user@host:~/somedir $ ls \ > # List directory file1 file2
Shell Script with Comments
user@host:~/somedir $ ls # List current directory conf lang README screen,gif ui info.txt manager.dat renderer.php syntax.php user@host:~/somedir $
Windows Command Window
Wiki text:
C:\Users\User>REM hello world! C:\Users\User>echo 'hello world!' 'hello world!'
Rendered result:
C:\Users\User>REM hello world! C:\Users\User>echo 'hello world!' 'hello world!'
Ruby irb
Simple minded implementation will not work for results as end of prompt is same as results marker!
irb(main):001:0> 2+2 => 4 irb(main):002:0>
Python
ActivePython 2.5.1.1 (ActiveState Software Inc.) based on Python 2.5.1 (r251:54863, May 1 2007, 17:47:05) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> 2+2 4 >>>
Python + Windows Shell (Nested CLIs)
Wiki text:
<cli prompt=">"> C:\Users\Chris Jobling>python <cli prompt=">>>"> ActivePython 2.5.1.1 (ActiveState Software Inc.) based on Python 2.5.1 (r251:54863, May 1 2007, 17:47:05) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> 2+2 4 >>> ^Z </cli> C:\Users\Chris Jobling> </cli>
Rendered result: Wiki text:
C:\Users\Chris Jobling>pythonActivePython 2.5.1.1 (ActiveState Software Inc.) based on Python 2.5.1 (r251:54863, May 1 2007, 17:47:05) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> 2+2 4 >>> ^ZC:\Users\Chris Jobling>
Corner Cases
- The following codes don't display right
<cli prompt="#"> # rpm -ivh darcs-1.0.9-3.fc6.i386.rpm Preparing... ########################################### [100%] 1:darcs ########################################### [100%] </cli>
# rpm -ivh darcs-1.0.9-3.fc6.i386.rpm Preparing... ########################################### [100%] 1:darcs ########################################### [100%]
Not sure to do about this as download progress marker uses same character as prompt!
- CLI shouldn't silently eat intentional blank lines:
<cli prompt=“$” comment=“#”> user@host:~/somedir $ ls # List current directory conf lang README screen,gif ui info.txt manager.dat renderer.php syntax.php
user@host:~/somedir $ # I intended there to be two blank lines above!