fish:
  pkg.installed:
    - name: fish

oh-my-fish:
  git.latest:
    - name: https://github.com/oh-my-fish/oh-my-fish
    - target: {{ grains.homedir }}/oh-my-fish
    - user: {{ grains.user }}

{{ grains.user }}:
   user.present:
    - shell: /usr/bin/fish

install-oh-my-fish:
  cmd.run:
    - name: bin/install --noninteractive --offline
    - cwd: {{ grains.homedir }}/oh-my-fish
    - runas: {{ grains.user }}
    - unless: test -d {{ grains.homedir }}/.local/share/omf

create-oh-my-fish-config-directory:
  file.directory:
    - name: {{ grains.homedir }}/.config/omf
    - user: {{ grains.user }}
    - group: {{ grains.group }}
    - makedirs: True
    - force: True

oh-my-fish-bundle-config:
  file.managed:
    - name: {{ grains.homedir }}/.config/omf/bundle
    - source: salt:///fish/files/bundle
    - user: {{ grains.user }}
    - group: {{ grains.group }}
    - force: True

fish-set-theme:
  file.managed:
    - name: {{ grains.homedir }}/.config/omf/theme
    - source: salt:///fish/files/theme
    - user: {{ grains.user }}
    - group: {{ grains.group }}
    - force: True

install-omf-packages:
  cmd.run:
    - name: fish -c "omf install"
    - runas: {{ grains.user }}