From c8381601e4e3b31969ea6108617356572a7d1ca3 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Sat, 23 Jun 2018 19:43:42 -0400 Subject: Deprecated CmdResult helper class and promoted CommandResult These classes are subtly different, particularly in terms of their truthiness. CmdResult - attributes: out, err, war - truthy: if err is falsy CommandResult - attributes: stdout, stderr, data - truthy: if err is falsy AND data is not None So CmdResult was oriented to provide essentially info, error, and warning messages to the user (typically as stirngs), whereas CommandResult is geared towards providing info and error messages to the user as strings in addition to data to the user in a command-specific format which is arbitrary other than it should never be None if the command succeeds. --- examples/scripts/conditional.py | 1 + 1 file changed, 1 insertion(+) (limited to 'examples/scripts/conditional.py') diff --git a/examples/scripts/conditional.py b/examples/scripts/conditional.py index 87cd10ac..d7ee5ea2 100644 --- a/examples/scripts/conditional.py +++ b/examples/scripts/conditional.py @@ -30,6 +30,7 @@ app('cd {}'.format(directory)) if self._last_result: print('\nContents of directory {!r}:'.format(directory)) app('dir -l') + print('{}\n'.format(self._last_result.data)) # Change back to where we were print('Changing back to original directory: {!r}'.format(original_dir)) -- cgit v1.2.1