From 801bab847341fb9a35d10f1d0b4a629a4fc8f14c Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Thu, 19 Dec 2019 16:04:06 -0500 Subject: Changed allow_ansi to allow_style for accuracy in what types of ANSI escape sequences are handled --- examples/colors.py | 14 +++++++------- examples/plumbum_colors.py | 14 +++++++------- examples/transcripts/exampleSession.txt | 2 +- examples/transcripts/transcript_regex.txt | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) (limited to 'examples') 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 -- cgit v1.2.1