From 1daf5d2cb63145408520f39c799425a82b2ec948 Mon Sep 17 00:00:00 2001 From: kotfu Date: Sat, 11 Aug 2018 19:54:10 -0600 Subject: First pass at improved colorizing - colors setting now allows Always, Terminal, Never values - poutput() and perror() honor these new settings --- tests/conftest.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'tests/conftest.py') diff --git a/tests/conftest.py b/tests/conftest.py index 3f3b862e..9ca506af 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -80,11 +80,8 @@ SHORTCUTS_TXT = """Shortcuts for other commands: @@: _relative_load """ -expect_colors = True -if sys.platform.startswith('win'): - expect_colors = False # Output from the show command with default settings -SHOW_TXT = """colors: {} +SHOW_TXT = """colors: Terminal continuation_prompt: > debug: False echo: False @@ -94,14 +91,10 @@ locals_in_py: False prompt: (Cmd) quiet: False timing: False -""".format(expect_colors) +""" -if expect_colors: - color_str = 'True ' -else: - color_str = 'False' SHOW_LONG = """ -colors: {} # Colorized output (*nix only) +colors: Terminal # Allow colorized output continuation_prompt: > # On 2nd+ line of input debug: False # Show full error stack on error echo: False # Echo command issued into output @@ -111,7 +104,7 @@ locals_in_py: False # Allow access to your application in py via self prompt: (Cmd) # The prompt issued to solicit input quiet: False # Don't print nonessential feedback timing: False # Report execution times -""".format(color_str) +""" class StdOut(object): @@ -128,6 +121,9 @@ class StdOut(object): def clear(self): self.buffer = '' + def isatty(self): + return True + def normalize(block): """ Normalize a block of text to perform comparison. -- cgit v1.2.1 From ccbe1276f786e94f1996877fdec6d070705f5ab8 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Wed, 19 Sep 2018 15:32:37 -0400 Subject: cmd2.Cmd.__init__ now initializes colorama and tells it to never strip ANSI codes since cmd2 deals with that Also: - Finished editing poutput(), ppaged(), and pfeedback() methods to strip ANSI color when appropriate - Changed attr.ib() factory usage so cmd2 is compatible with older versions of attrs --- tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/conftest.py') diff --git a/tests/conftest.py b/tests/conftest.py index c86748e8..e177496b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -94,7 +94,7 @@ timing: False """ SHOW_LONG = """ -colors: Terminal # Allow colorized output +colors: Terminal # Allow colorized output (valid values: Terminal, Always, Never) continuation_prompt: > # On 2nd+ line of input debug: False # Show full error stack on error echo: False # Echo command issued into output -- cgit v1.2.1 From 26a9ea4277a61031274c48216aed21aae4e53eec Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Wed, 26 Sep 2018 11:50:22 -0400 Subject: Updated documentation --- tests/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/conftest.py') diff --git a/tests/conftest.py b/tests/conftest.py index faf1847d..124b482a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -36,12 +36,12 @@ edit history macro pyscript set shortcuts BASE_HELP_VERBOSE = """ Documented commands (type help ): ================================================================================ -alias Manages aliases +alias Manage aliases edit Edit a file in a text editor help List available commands with "help" or detailed help with "help cmd" history View, run, edit, save, or clear previously entered commands load Runs commands in script file that is encoded as either ASCII or UTF-8 text -macro Manages macros +macro Manage macros py Invoke python command, shell, or script pyscript Runs a python script file inside the console quit Exits this application -- cgit v1.2.1