From 13bc5314ce9f192ec713e073e21fee447c5f9b79 Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Thu, 21 Sep 2017 21:37:15 +0200 Subject: [PATCH] win_shortcut: Add hotkeys examples to documentation (#30694) This fixes #29110 --- lib/ansible/modules/windows/win_shortcut.ps1 | 26 +++---------- lib/ansible/modules/windows/win_shortcut.py | 41 +++++++------------- 2 files changed, 19 insertions(+), 48 deletions(-) diff --git a/lib/ansible/modules/windows/win_shortcut.ps1 b/lib/ansible/modules/windows/win_shortcut.ps1 index 2d60dc5d748..421276e4c08 100644 --- a/lib/ansible/modules/windows/win_shortcut.ps1 +++ b/lib/ansible/modules/windows/win_shortcut.ps1 @@ -1,29 +1,15 @@ #!powershell -# (c) 2016, Dag Wieers -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# WANT_JSON -# POWERSHELL_COMMON +# Copyright: (c) 2016, Dag Wieers (@dagwieers) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Based on: http://powershellblogger.com/2016/01/create-shortcuts-lnk-or-url-files-with-powershell/ +#Requires -Module Ansible.ModuleUtils.Legacy.psm1 + $ErrorActionPreference = "Stop" -$params = Parse-Args $args -supports_check_mode $true +$params = Parse-Args -arguments $args -supports_check_mode $true $check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false $orig_src = Get-AnsibleParam -obj $params -name "src" @@ -149,4 +135,4 @@ If ($state -eq "absent") { } } -Exit-Json $result +Exit-Json -obj $result diff --git a/lib/ansible/modules/windows/win_shortcut.py b/lib/ansible/modules/windows/win_shortcut.py index b24fb3ceade..1c4b3dc6197 100644 --- a/lib/ansible/modules/windows/win_shortcut.py +++ b/lib/ansible/modules/windows/win_shortcut.py @@ -1,29 +1,14 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# (c) 2016, Dag Wieers -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: (c) 2016, Dag Wieers (@dagwieers) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} - -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: win_shortcut version_added: '2.3' @@ -59,20 +44,18 @@ options: hotkey: description: - Key combination for the shortcut. + - This is a combination of one or more modifiers and a key. + - Possible modifiers are Alt, Ctrl, Shift, Ext. + - Possible keys are [A-Z] and [0-9]. windowstyle: description: - Influences how the application is displayed when it is launched. - choices: - - maximized - - minimized - - normal + choices: [ maximized, minimized, normal ] state: description: - - When C(present), creates or updates the shortcut. When C(absent), - removes the shortcut if it exists. - choices: - - absent - - present + - When C(present), creates or updates the shortcut. + - When C(absent), removes the shortcut if it exists. + choices: [ absent, present ] default: present author: - Dag Wieers (@dagwieers) @@ -95,6 +78,7 @@ EXAMPLES = r''' dest: '%Public%\Desktop\Mozilla Firefox.lnk' icon: '%ProgramFiles\Mozilla Firefox\Firefox.exe,0' directory: '%ProgramFiles%\Mozilla Firefox' + hotkey: Ctrl+Alt+F - name: Create an application shortcut for an executable in PATH to your desktop win_shortcut: @@ -108,6 +92,7 @@ EXAMPLES = r''' args: --new-window https://ansible.com/ directory: '%ProgramFiles%\Google\Chrome\Application' icon: '%ProgramFiles%\Google\Chrome\Application\chrome.exe,0' + hotkey: Ctrl+Alt+A - name: Create a URL shortcut for the Ansible website win_shortcut: @@ -115,5 +100,5 @@ EXAMPLES = r''' dest: '%Public%\Desktop\Ansible website.url' ''' -RETURN = ''' +RETURN = r''' '''