Skip to content

Commit 6e7550d

Browse files
committed
Updates examples to show propery use of styles
1 parent 37cb694 commit 6e7550d

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

examples/colors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def do_speak(self, args):
7777

7878
for _ in range(min(repetitions, self.maxrepeats)):
7979
# .poutput handles newlines, and accommodates output redirection too
80-
self.poutput(output_str)
80+
self.poutput(output_str, apply_style=False)
8181

8282
def do_timetravel(self, _):
8383
"""A command which always generates an error message, to demonstrate custom error colors"""

examples/initialization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def do_intro(self, _):
6464
def do_echo(self, arg):
6565
"""Example of a multiline command"""
6666
fg_color = Fg[self.foreground_color.upper()]
67-
self.poutput(style(arg, fg=fg_color))
67+
self.poutput(style(arg, fg=fg_color), apply_style=False)
6868

6969

7070
if __name__ == '__main__':

examples/pirate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def do_quit(self, arg):
7676

7777
def do_sing(self, arg):
7878
"""Sing a colorful song."""
79-
self.poutput(cmd2.ansi.style(arg, fg=Fg[self.songcolor.upper()]))
79+
self.poutput(cmd2.ansi.style(arg, fg=Fg[self.songcolor.upper()]), apply_style=False)
8080

8181
yo_parser = cmd2.Cmd2ArgumentParser()
8282
yo_parser.add_argument('--ho', type=int, default=2, help="How often to chant 'ho'")

0 commit comments

Comments
 (0)