summaryrefslogtreecommitdiff
path: root/examples/python_scripting.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2019-06-27 23:54:07 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2019-06-27 23:54:07 -0400
commitf91ccf2bb28531f9d1dee551314cb091fa57df74 (patch)
treec4f2571eda21f4b2d636545f0f89a8835aa057fd /examples/python_scripting.py
parent00388938d2c02922660e63ae163373b25789fafa (diff)
downloadcmd2-git-f91ccf2bb28531f9d1dee551314cb091fa57df74.tar.gz
Simplified ansi color dictionaries and lookup methods
Also: - Updated examples that use color to use cmd2.ansi instead of colorama - Updated tests that use color to use cmd2.ansi instead of colorama - plumbum_colorspy example shows how to override color lookup functions to use a different color library
Diffstat (limited to 'examples/python_scripting.py')
-rwxr-xr-xexamples/python_scripting.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/examples/python_scripting.py b/examples/python_scripting.py
index 0cbfddff..3d0a54a9 100755
--- a/examples/python_scripting.py
+++ b/examples/python_scripting.py
@@ -17,9 +17,8 @@ This application and the "scripts/conditional.py" script serve as an example for
import argparse
import os
-from colorama import Fore
-
import cmd2
+from cmd2 import ansi
class CmdLineApp(cmd2.Cmd):
@@ -35,7 +34,7 @@ class CmdLineApp(cmd2.Cmd):
def _set_prompt(self):
"""Set prompt so it displays the current working directory."""
self.cwd = os.getcwd()
- self.prompt = Fore.CYAN + '{!r} $ '.format(self.cwd) + Fore.RESET
+ self.prompt = ansi.style('{!r} $ '.format(self.cwd), fg='cyan')
def postcmd(self, stop: bool, line: str) -> bool:
"""Hook method executed just after a command dispatch is finished.