Skip to content

Commit

Permalink
reformat module docs
Browse files Browse the repository at this point in the history
  • Loading branch information
russoz committed Sep 17, 2024
1 parent e4472b3 commit eb97dea
Show file tree
Hide file tree
Showing 2 changed files with 148 additions and 153 deletions.
170 changes: 81 additions & 89 deletions plugins/modules/xfconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@
from __future__ import absolute_import, division, print_function
__metaclass__ = type

DOCUMENTATION = '''
DOCUMENTATION = """
---
module: xfconf
author:
- "Joseph Benden (@jbenden)"
- "Alexei Znamensky (@russoz)"
- "Joseph Benden (@jbenden)"
- "Alexei Znamensky (@russoz)"
short_description: Edit XFCE4 Configurations
description:
- This module allows for the manipulation of Xfce 4 Configuration with the help of
xfconf-query. Please see the xfconf-query(1) man page for more details.
- This module allows for the manipulation of Xfce 4 Configuration with the help of xfconf-query. Please see the xfconf-query(1) man page for more details.
seealso:
- name: xfconf-query(1) man page
description: Manual page of the C(xfconf-query) tool at the XFCE documentation site.
link: 'https://docs.xfce.org/xfce/xfconf/xfconf-query'
- name: xfconf-query(1) man page
description: Manual page of the C(xfconf-query) tool at the XFCE documentation site.
link: 'https://docs.xfce.org/xfce/xfconf/xfconf-query'
- name: xfconf - Configuration Storage System
description: XFCE documentation for the Xfconf configuration system.
link: 'https://docs.xfce.org/xfce/xfconf/start'
- name: xfconf - Configuration Storage System
description: XFCE documentation for the Xfconf configuration system.
link: 'https://docs.xfce.org/xfce/xfconf/start'
extends_documentation_fragment:
- community.general.attributes
- community.general.attributes
attributes:
check_mode:
Expand All @@ -38,55 +38,49 @@
options:
channel:
description:
- A Xfconf preference channel is a top-level tree key, inside of the
Xfconf repository that corresponds to the location for which all
application properties/keys are stored. See man xfconf-query(1).
- A Xfconf preference channel is a top-level tree key, inside of the Xfconf repository that corresponds to the location for which all application properties/keys
are stored. See man xfconf-query(1).
required: true
type: str
property:
description:
- A Xfce preference key is an element in the Xfconf repository
that corresponds to an application preference. See man xfconf-query(1).
- A Xfce preference key is an element in the Xfconf repository that corresponds to an application preference. See man xfconf-query(1).
required: true
type: str
value:
description:
- Preference properties typically have simple values such as strings,
integers, or lists of strings and integers. See man xfconf-query(1).
- Preference properties typically have simple values such as strings, integers, or lists of strings and integers. See man xfconf-query(1).
type: list
elements: raw
value_type:
description:
- The type of value being set.
- When providing more than one O(value_type), the length of the list must
be equal to the length of O(value).
- If only one O(value_type) is provided, but O(value) contains more than
on element, that O(value_type) will be applied to all elements of O(value).
- If the O(property) being set is an array and it can possibly have only one
element in the array, then O(force_array=true) must be used to ensure
that C(xfconf-query) will interpret the value as an array rather than a
scalar.
- Support for V(uchar), V(char), V(uint64), and V(int64) has been added in community.general 4.8.0.
- The type of value being set.
- When providing more than one O(value_type), the length of the list must be equal to the length of O(value).
- If only one O(value_type) is provided, but O(value) contains more than on element, that O(value_type) will be applied to all elements of O(value).
- If the O(property) being set is an array and it can possibly have only one element in the array, then O(force_array=true) must be used to ensure that C(xfconf-query)
will interpret the value as an array rather than a scalar.
- Support for V(uchar), V(char), V(uint64), and V(int64) has been added in community.general 4.8.0.
type: list
elements: str
choices: [ string, int, double, bool, uint, uchar, char, uint64, int64, float ]
choices: [string, int, double, bool, uint, uchar, char, uint64, int64, float]
state:
type: str
description:
- The action to take upon the property/value.
- The state V(get) has been removed in community.general 5.0.0. Please use the module M(community.general.xfconf_info) instead.
choices: [ present, absent ]
- The action to take upon the property/value.
- The state V(get) has been removed in community.general 5.0.0. Please use the module M(community.general.xfconf_info) instead.
choices: [present, absent]
default: "present"
force_array:
description:
- Force array even if only one element.
- Force array even if only one element.
type: bool
default: false
aliases: ['array']
version_added: 1.0.0
'''
"""

EXAMPLES = """
---
- name: Change the DPI to "192"
xfconf:
channel: "xsettings"
Expand All @@ -110,60 +104,58 @@
force_array: true
"""

RETURN = '''
channel:
description: The channel specified in the module parameters
returned: success
type: str
sample: "xsettings"
property:
description: The property specified in the module parameters
returned: success
type: str
sample: "/Xft/DPI"
value_type:
description:
- The type of the value that was changed (V(none) for O(state=reset)).
Either a single string value or a list of strings for array types.
- This is a string or a list of strings.
returned: success
type: any
sample: '"int" or ["str", "str", "str"]'
value:
description:
- The value of the preference key after executing the module. Either a
single string value or a list of strings for array types.
- This is a string or a list of strings.
returned: success
type: any
sample: '"192" or ["orange", "yellow", "violet"]'
previous_value:
description:
- The value of the preference key before executing the module.
Either a single string value or a list of strings for array types.
- This is a string or a list of strings.
returned: success
type: any
sample: '"96" or ["red", "blue", "green"]'
cmd:
description:
- A list with the resulting C(xfconf-query) command executed by the module.
returned: success
type: list
elements: str
version_added: 5.4.0
sample:
- /usr/bin/xfconf-query
- --channel
- xfce4-panel
- --property
- /plugins/plugin-19/timezone
- --create
- --type
- string
- --set
- Pacific/Auckland
'''
RETURN = """
---
channel:
description: The channel specified in the module parameters
returned: success
type: str
sample: "xsettings"
property:
description: The property specified in the module parameters
returned: success
type: str
sample: "/Xft/DPI"
value_type:
description:
- The type of the value that was changed (V(none) for O(state=reset)). Either a single string value or a list of strings for array types.
- This is a string or a list of strings.
returned: success
type: any
sample: '"int" or ["str", "str", "str"]'
value:
description:
- The value of the preference key after executing the module. Either a single string value or a list of strings for array types.
- This is a string or a list of strings.
returned: success
type: any
sample: '"192" or ["orange", "yellow", "violet"]'
previous_value:
description:
- The value of the preference key before executing the module. Either a single string value or a list of strings for array types.
- This is a string or a list of strings.
returned: success
type: any
sample: '"96" or ["red", "blue", "green"]'
cmd:
description:
- A list with the resulting C(xfconf-query) command executed by the module.
returned: success
type: list
elements: str
version_added: 5.4.0
sample:
- /usr/bin/xfconf-query
- --channel
- xfce4-panel
- --property
- /plugins/plugin-19/timezone
- --create
- --type
- string
- --set
- Pacific/Auckland
"""

from ansible_collections.community.general.plugins.module_utils.module_helper import StateModuleHelper
from ansible_collections.community.general.plugins.module_utils.xfconf import xfconf_runner
Expand Down
131 changes: 67 additions & 64 deletions plugins/modules/xfconf_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
from __future__ import absolute_import, division, print_function
__metaclass__ = type

DOCUMENTATION = '''
DOCUMENTATION = """
---
module: xfconf_info
author:
- "Alexei Znamensky (@russoz)"
- "Alexei Znamensky (@russoz)"
short_description: Retrieve XFCE4 configurations
version_added: 3.5.0
description:
- This module allows retrieving Xfce 4 configurations with the help of C(xfconf-query).
- This module allows retrieving Xfce 4 configurations with the help of C(xfconf-query).
extends_documentation_fragment:
- community.general.attributes
- community.general.attributes.info_module
- community.general.attributes
- community.general.attributes.info_module
attributes:
check_mode:
version_added: 3.3.0
Expand All @@ -40,10 +41,11 @@
- If not provided and a O(channel) is provided, then the module will list all available properties in that O(channel).
type: str
notes:
- See man xfconf-query(1) for more details.
'''
- See man xfconf-query(1) for more details.
"""

EXAMPLES = """
---
- name: Get list of all available channels
community.general.xfconf_info: {}
register: result
Expand All @@ -66,63 +68,64 @@
register: result
"""

RETURN = '''
channels:
description:
- List of available channels.
- Returned when the module receives no parameter at all.
returned: success
type: list
elements: str
sample:
- xfce4-desktop
- displays
- xsettings
- xfwm4
properties:
description:
- List of available properties for a specific channel.
- Returned by passing only the O(channel) parameter to the module.
returned: success
type: list
elements: str
sample:
- /Gdk/WindowScalingFactor
- /Gtk/ButtonImages
- /Gtk/CursorThemeSize
- /Gtk/DecorationLayout
- /Gtk/FontName
- /Gtk/MenuImages
- /Gtk/MonospaceFontName
- /Net/DoubleClickTime
- /Net/IconThemeName
- /Net/ThemeName
- /Xft/Antialias
- /Xft/Hinting
- /Xft/HintStyle
- /Xft/RGBA
is_array:
description:
- Flag indicating whether the property is an array or not.
returned: success
type: bool
value:
description:
- The value of the property. Empty if the property is of array type.
returned: success
type: str
sample: Monospace 10
value_array:
description:
- The array value of the property. Empty if the property is not of array type.
returned: success
type: list
elements: str
sample:
- Main
- Work
- Tmp
'''
RETURN = """
---
channels:
description:
- List of available channels.
- Returned when the module receives no parameter at all.
returned: success
type: list
elements: str
sample:
- xfce4-desktop
- displays
- xsettings
- xfwm4
properties:
description:
- List of available properties for a specific channel.
- Returned by passing only the O(channel) parameter to the module.
returned: success
type: list
elements: str
sample:
- /Gdk/WindowScalingFactor
- /Gtk/ButtonImages
- /Gtk/CursorThemeSize
- /Gtk/DecorationLayout
- /Gtk/FontName
- /Gtk/MenuImages
- /Gtk/MonospaceFontName
- /Net/DoubleClickTime
- /Net/IconThemeName
- /Net/ThemeName
- /Xft/Antialias
- /Xft/Hinting
- /Xft/HintStyle
- /Xft/RGBA
is_array:
description:
- Flag indicating whether the property is an array or not.
returned: success
type: bool
value:
description:
- The value of the property. Empty if the property is of array type.
returned: success
type: str
sample: Monospace 10
value_array:
description:
- The array value of the property. Empty if the property is not of array type.
returned: success
type: list
elements: str
sample:
- Main
- Work
- Tmp
"""

from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelper
from ansible_collections.community.general.plugins.module_utils.xfconf import xfconf_runner
Expand Down

0 comments on commit eb97dea

Please sign in to comment.