Add echo option to pause module (#32205)

* Enable ECHO in prompt module

Fixes #14160

* Add option for controlling echo behavior with pause module

* Improve option logic

Allow all options to be used in varying combinations, rather than being mutually exclusive.
Always capture output and return it, even when a time limit is set.

* Add version_added to docs

* Improve behavior of echo output

Set a few more flags to allow interactive deletion and hide control characters.
Do not capture or echo input when a time is set. Tried to get this working nicely, but ran into too many issues/oddities to keep it. Maybe in the future if there is demand for capturing/echoing input when a time is set I'll take another pass at it.
This commit is contained in:
Sam Doran 2017-11-03 13:32:36 -04:00 committed by Brian Coca
commit e65045f51f
2 changed files with 67 additions and 23 deletions

View file

@ -40,10 +40,19 @@ options:
- Optional text to use for the prompt message.
required: false
default: null
echo:
description:
- Contols whether or not keyboard input is shown when typing.
- Has no effect if 'seconds' or 'minutes' is set.
required: false
default: 'yes'
choices: ['yes', 'no']
version_added: 2.5
author: "Tim Bielawa (@tbielawa)"
notes:
- Starting in 2.2, if you specify 0 or negative for minutes or seconds, it will wait for 1 second, previously it would wait indefinitely.
- This module is also supported for Windows targets.
- User input is not captured or echoed, regardless of echo setting, when minutes or seconds is specified.
'''
EXAMPLES = '''
@ -57,6 +66,11 @@ EXAMPLES = '''
# A helpful reminder of what to look out for post-update.
- pause:
prompt: "Make sure org.foo.FooOverload exception is not present"
# Pause to get some sensitive input.
- pause:
prompt: "Enter a secret"
echo: no
'''
RETURN = '''
@ -85,4 +99,9 @@ stdout:
returned: always
type: string
sample: Paused for 0.04 minutes
echo:
description: Value of echo setting
returned: always
type: bool
sample: true
'''