Différences
Ci-dessous, les différences entre deux révisions de la page.
playground [2018/03/05 13:57] abelard-a créée |
playground [2018/03/05 14:00] (Version actuelle) abelard-a |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | ====== Tests of CLI Plugin ====== | ||
+ | |||
+ | This page provides a set of test cases for the [[plugins: | ||
+ | |||
+ | ===== Basic Shell Script ===== | ||
+ | |||
+ | Wiki text: | ||
+ | < | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 55 108 1032 info.txt | ||
+ | | ||
+ | </ | ||
+ | |||
+ | Rendered result: | ||
+ | |||
<cli> | <cli> | ||
- | abelard-a@UN-5CG54835CN:~$ cat /etc/apt/sources.list.d/ | + | user@host:~/somedir $ ls |
- | deb http://downloads.opennebula.org/repo/5.4/Ubuntu/ | + | conf lang |
+ | info.txt manager.dat renderer.php | ||
+ | user@host:~/somedir $ wc info.txt # count words in info.txt | ||
+ | 55 108 1032 info.txt | ||
+ | user@host:~/somedir $ | ||
</ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== Shell Script with Comments ===== | ||
+ | |||
+ | <cli comment="#"> | ||
+ | user@host: | ||
+ | conf lang | ||
+ | info.txt | ||
+ | user@host: | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== Root Shell Script with Comments ===== | ||
+ | |||
+ | This (default shell comment character): | ||
+ | |||
+ | < | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | renders as this: | ||
+ | |||
+ | <cli prompt="#"> | ||
+ | root@host: | ||
+ | conf lang | ||
+ | info.txt | ||
+ | root@host: | ||
+ | </ | ||
+ | |||
+ | This is also valid: | ||
+ | |||
+ | < | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | <cli prompt="# | ||
+ | root@host: | ||
+ | conf lang | ||
+ | info.txt | ||
+ | root@host: | ||
+ | </ | ||
+ | |||
+ | Example with a continuation prompt: | ||
+ | |||
+ | <cli prompt=" | ||
+ | user@host: | ||
+ | > # List directory | ||
+ | file1 file2 | ||
+ | </ | ||
+ | |||
+ | <cli prompt=" | ||
+ | user@host: | ||
+ | > # List directory | ||
+ | file1 file2 | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Shell Script with Comments ===== | ||
+ | |||
+ | <cli prompt=" | ||
+ | user@host: | ||
+ | conf lang | ||
+ | info.txt | ||
+ | user@host: | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== Windows Command Window ===== | ||
+ | |||
+ | Wiki text: | ||
+ | |||
+ | <cli prompt=">" | ||
+ | C: | ||
+ | C: | ||
+ | 'hello world!' | ||
+ | </ | ||
+ | |||
+ | Rendered result: | ||
+ | |||
+ | <cli prompt=">" | ||
+ | C: | ||
+ | C: | ||
+ | 'hello world!' | ||
+ | </ | ||
+ | |||
+ | ===== Ruby irb ===== | ||
+ | |||
+ | Simple minded implementation will not work for results as end of prompt is same as results marker! | ||
+ | <cli prompt=">"> | ||
+ | irb(main): | ||
+ | => 4 | ||
+ | irb(main): | ||
+ | </ | ||
+ | |||
+ | ===== Python ===== | ||
+ | |||
+ | <cli prompt=">>>"> | ||
+ | ActivePython 2.5.1.1 (ActiveState Software Inc.) based on | ||
+ | Python 2.5.1 (r251: | ||
+ | win32 | ||
+ | Type " | ||
+ | >>> | ||
+ | 4 | ||
+ | >>> | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== Python + Windows Shell (Nested CLIs) ===== | ||
+ | |||
+ | Wiki text: | ||
+ | < | ||
+ | | ||
+ | < | ||
+ | | ||
+ | | ||
+ | win32 | ||
+ | Type " | ||
+ | >>> | ||
+ | 4 | ||
+ | >>> | ||
+ | |||
+ | </ | ||
+ | | ||
+ | </ | ||
+ | |||
+ | Rendered result: | ||
+ | Wiki text: | ||
+ | <cli prompt=">"> | ||
+ | C: | ||
+ | <cli prompt=">"> | ||
+ | ActivePython 2.5.1.1 (ActiveState Software Inc.) based on | ||
+ | Python 2.5.1 (r251: | ||
+ | win32 | ||
+ | Type " | ||
+ | >>> | ||
+ | 4 | ||
+ | >>> | ||
+ | |||
+ | </ | ||
+ | C: | ||
+ | </ | ||
+ | |||
+ | ===== Corner Cases ===== | ||
+ | |||
+ | * The following codes don't display right | ||
+ | < | ||
+ | <cli prompt="#"> | ||
+ | # rpm -ivh darcs-1.0.9-3.fc6.i386.rpm | ||
+ | Preparing... | ||
+ | | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | <cli prompt="#"> | ||
+ | # rpm -ivh darcs-1.0.9-3.fc6.i386.rpm | ||
+ | Preparing... | ||
+ | | ||
+ | </ | ||
+ | |||
+ | Not sure to do about this as download progress marker uses same character as prompt! | ||
+ | |||
+ | * CLI shouldn' | ||
+ | |||
+ | <cli prompt=" | ||
+ | user@host: | ||
+ | conf lang | ||
+ | info.txt | ||
+ | |||
+ | |||
+ | user@host: | ||
+ |