---
# @action Ensures Rust shell completions are set-up
# Sets up shell completions for PowerShell on Windows
- name: Ensure directories to store completions file exists
  become_user: '{{ user.username }}'
  ansible.windows.win_file:
    path: '%USERPROFILE%\Documents\WindowsPowershell'
    state: directory

- name: Ensure rustup PowerShell completions file exists
  become_user: '{{ user.username }}'
  ansible.windows.win_shell: rustup completions powershell >> $PROFILE.CurrentUserCurrentHost
  args:
    creates: '%USERPROFILE%\Documents\WindowsPowershell\Microsoft.PowerShell_profile.ps1'
