summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-12-19 16:04:06 -0500
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-12-19 16:04:06 -0500
commit801bab847341fb9a35d10f1d0b4a629a4fc8f14c (patch)
tree889c2d21f0922e68b0c880a6c0c9b3e83c307cd1 /examples
parente13fc34e6f7d9e67422595411b62ff12b8bf769b (diff)
downloadcmd2-git-801bab847341fb9a35d10f1d0b4a629a4fc8f14c.tar.gz
Changed allow_ansi to allow_style for accuracy in what types of ANSI escape sequences are handled
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/colors.py14
-rwxr-xr-xexamples/plumbum_colors.py14
-rw-r--r--examples/transcripts/exampleSession.txt2
-rw-r--r--examples/transcripts/transcript_regex.txt2
4 files changed, 16 insertions, 16 deletions
diff --git a/examples/colors.py b/examples/colors.py
index 8c54dfa4..ea8be479 100755
--- a/examples/colors.py
+++ b/examples/colors.py
@@ -6,21 +6,21 @@ A sample application for cmd2. Demonstrating colorized output.
Experiment with the command line options on the `speak` command to see how
different output colors ca
-The allow_ansi setting has three possible values:
+The allow_style setting has three possible values:
Never
- poutput(), pfeedback(), and ppaged() strip all ANSI escape sequences
+ poutput(), pfeedback(), and ppaged() strip all ANSI style sequences
which instruct the terminal to colorize output
Terminal
(the default value) poutput(), pfeedback(), and ppaged() do not strip any
- ANSI escape sequences when the output is a terminal, but if the output is
- a pipe or a file the escape sequences are stripped. If you want colorized
- output you must add ANSI escape sequences using either cmd2's internal ansi
+ ANSI style sequences when the output is a terminal, but if the output is
+ a pipe or a file the style sequences are stripped. If you want colorized
+ output you must add ANSI style sequences using either cmd2's internal ansi
module or another color library such as `plumbum.colors` or `colorama`.
Always
- poutput(), pfeedback(), and ppaged() never strip ANSI escape sequences,
+ poutput(), pfeedback(), and ppaged() never strip ANSI style sequences,
regardless of the output destination
"""
import argparse
@@ -40,7 +40,7 @@ class CmdLineApp(cmd2.Cmd):
self.settable['maxrepeats'] = 'max repetitions for speak command'
# Should ANSI color output be allowed
- self.allow_ansi = ansi.ANSI_TERMINAL
+ self.allow_style = ansi.STYLE_TERMINAL
speak_parser = argparse.ArgumentParser()
speak_parser.add_argument('-p', '--piglatin', action='store_true', help='atinLay')
diff --git a/examples/plumbum_colors.py b/examples/plumbum_colors.py
index a969c4de..8eaf3fe8 100755
--- a/examples/plumbum_colors.py
+++ b/examples/plumbum_colors.py
@@ -6,21 +6,21 @@ A sample application for cmd2. Demonstrating colorized output using the plumbum
Experiment with the command line options on the `speak` command to see how
different output colors ca
-The allow_ansi setting has three possible values:
+The allow_style setting has three possible values:
Never
- poutput(), pfeedback(), and ppaged() strip all ANSI escape sequences
+ poutput(), pfeedback(), and ppaged() strip all ANSI style sequences
which instruct the terminal to colorize output
Terminal
(the default value) poutput(), pfeedback(), and ppaged() do not strip any
- ANSI escape sequences when the output is a terminal, but if the output is
- a pipe or a file the escape sequences are stripped. If you want colorized
- output you must add ANSI escape sequences using either cmd2's internal ansi
+ ANSI style sequences when the output is a terminal, but if the output is
+ a pipe or a file the style sequences are stripped. If you want colorized
+ output you must add ANSI style sequences using either cmd2's internal ansi
module or another color library such as `plumbum.colors` or `colorama`.
Always
- poutput(), pfeedback(), and ppaged() never strip ANSI escape sequences,
+ poutput(), pfeedback(), and ppaged() never strip ANSI style sequences,
regardless of the output destination
WARNING: This example requires the plumbum package, which isn't normally required by cmd2.
@@ -78,7 +78,7 @@ class CmdLineApp(cmd2.Cmd):
self.settable['maxrepeats'] = 'max repetitions for speak command'
# Should ANSI color output be allowed
- self.allow_ansi = ansi.ANSI_TERMINAL
+ self.allow_style = ansi.STYLE_TERMINAL
speak_parser = argparse.ArgumentParser()
speak_parser.add_argument('-p', '--piglatin', action='store_true', help='atinLay')
diff --git a/examples/transcripts/exampleSession.txt b/examples/transcripts/exampleSession.txt
index 3e579c28..5a75235b 100644
--- a/examples/transcripts/exampleSession.txt
+++ b/examples/transcripts/exampleSession.txt
@@ -3,7 +3,7 @@
# The regex for editor will match whatever program you use.
# regexes on prompts just make the trailing space obvious
(Cmd) set
-allow_ansi: /(Terminal|Always|Never)/
+allow_style: /(Terminal|Always|Never)/
continuation_prompt: >/ /
debug: False
echo: False
diff --git a/examples/transcripts/transcript_regex.txt b/examples/transcripts/transcript_regex.txt
index d94c442b..276f7d22 100644
--- a/examples/transcripts/transcript_regex.txt
+++ b/examples/transcripts/transcript_regex.txt
@@ -3,7 +3,7 @@
# The regex for editor will match whatever program you use.
# regexes on prompts just make the trailing space obvious
(Cmd) set
-allow_ansi: /(Terminal|Always|Never)/
+allow_style: /(Terminal|Always|Never)/
continuation_prompt: >/ /
debug: False
echo: False