1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add option allowing the user to specify a custom cowpath

This allows the user to use custom cowsay implementations without shadowing common cowsay paths
This commit is contained in:
Matt Bachmann 2017-12-03 14:33:18 -05:00 committed by Brian Coca
parent 96335b12bb
commit f64b276f6a
2 changed files with 15 additions and 1 deletions

View file

@ -56,6 +56,15 @@ ANSIBLE_NOCOWS:
- {key: nocows, section: defaults} - {key: nocows, section: defaults}
type: boolean type: boolean
yaml: {key: display.i_am_no_fun} yaml: {key: display.i_am_no_fun}
ANSIBLE_COWPATH:
name: Set path to cowsay command
default: null
description: Specify a custom cowsay path or swap in your cowsay implementation of choice
env: [{name: ANSIBLE_COWPATH}]
ini:
- {key: cowpath, section: defaults}
type: string
yaml: {key: display.cowpath}
ANSIBLE_PIPELINING: ANSIBLE_PIPELINING:
name: Connection pipelining name: Connection pipelining
default: False default: False

View file

@ -98,7 +98,12 @@ class Display:
self._set_column_width() self._set_column_width()
def set_cowsay_info(self): def set_cowsay_info(self):
if not C.ANSIBLE_NOCOWS: if C.ANSIBLE_NOCOWS:
return
if C.ANSIBLE_COWPATH:
self.b_cowsay = C.ANSIBLE_COWPATH
else:
for b_cow_path in b_COW_PATHS: for b_cow_path in b_COW_PATHS:
if os.path.exists(b_cow_path): if os.path.exists(b_cow_path):
self.b_cowsay = b_cow_path self.b_cowsay = b_cow_path