---
- name: fonts | Create font directory for Iosevka
  file:
    path: '{{ xdg_dir.data_home }}/fonts/iosevka'
    mode: '755'
    state: directory

- name: fonts | Download Iosevka font archives
  get_url:
    url: https://github.com/be5invis/Iosevka/releases/download/v{{ font_versions.iosevka }}/super-ttc-{{ item }}-{{ font_versions.iosevka }}.zip
    dest: /tmp/{{ item }}.zip
    mode: '644'
  loop:
    - iosevka
    - iosevka-aile
    - iosevka-curly
    - iosevka-curly-slab
    - iosevka-etoile
    - iosevka-slab

- name: fonts | Decompress downloaded Iosevka font archives # noqa: command-instead-of-module
  command: unzip /tmp/{{ item }}.zip -d {{ xdg_dir.data_home }}/fonts/iosevka
  args:
    creates: '{{ xdg_dir.data_home }}/fonts/iosevka/{{ item }}.ttc'
  loop:
    - iosevka
    - iosevka-aile
    - iosevka-curly
    - iosevka-curly-slab
    - iosevka-etoile
    - iosevka-slab
