Mercurial > python-cmd2
comparison docs/freefeatures.rst @ 435:bfbe4241bd6b
custom double-redirector fixed
author | catherine.devlin@gmail.com |
---|---|
date | Thu, 25 Aug 2011 15:24:56 -0400 |
parents | e60e2c15f026 |
children |
comparison
equal
deleted
inserted
replaced
434:742fd308f0c9 | 435:bfbe4241bd6b |
---|---|
74 - sent to the paste buffer, ready for the next Copy operation, by | 74 - sent to the paste buffer, ready for the next Copy operation, by |
75 ending with a bare ``>``, as in ``mycommand args >``.. Redirecting | 75 ending with a bare ``>``, as in ``mycommand args >``.. Redirecting |
76 to paste buffer requires software to be installed on the operating | 76 to paste buffer requires software to be installed on the operating |
77 system, pywin32_ on Windows or xclip_ on \*nix. | 77 system, pywin32_ on Windows or xclip_ on \*nix. |
78 | 78 |
79 If your application depends on mathematical syntax, ``>`` may be a bad | |
80 choice for redirecting output - it will prevent you from using the | |
81 greater-than sign in your actual user commands. You can override your | |
82 app's value of ``self.redirector`` to use a different string for output redirection:: | |
83 | |
84 class MyApp(cmd2.Cmd): | |
85 redirector = '->' | |
86 | |
87 :: | |
88 | |
89 (Cmd) say line1 -> out.txt | |
90 (Cmd) say line2 ->-> out.txt | |
91 (Cmd) !cat out.txt | |
92 line1 | |
93 line2 | |
94 | |
79 .. _pywin32: http://sourceforge.net/projects/pywin32/ | 95 .. _pywin32: http://sourceforge.net/projects/pywin32/ |
80 .. _xclip: http://www.cyberciti.biz/faq/xclip-linux-insert-files-command-output-intoclipboard/ | 96 .. _xclip: http://www.cyberciti.biz/faq/xclip-linux-insert-files-command-output-intoclipboard/ |
81 | 97 |
82 Python | 98 Python |
83 ====== | 99 ====== |