---
- include: 'tools/dotbot-defaults.yaml'

- clean:
    ~/:
    ~/.config:
      recursive: true
    ~/.local:
      recursive: true
    ~/.ssh:
      recursive: true

- create:
    ~/.cache:
    ~/.cache/git:
    ~/.config:
    ~/.local:
    ~/.local/bin:
    ~/.local/run:
    ~/.local/share:
    ~/.local/share/gnupg:
      mode: 0700
    ~/.local/state:
    ~/.local/state/tmux:
    ~/.local/state/zsh:
    ~/.ssh:
      mode: 0700
    ~/.ssh/local.d:
      mode: 0700
    ~/Code:

- link:
    ~/:
      force: true
      glob: true
      path: base/*
      prefix: '.'
    # Most of the configs
    ~/.config/:
      glob: true
      relink: true
      path: config/*
      exclude: [config/nvm, config/fzf, config/op]
    # 1Password CLI plugins
    ~/.config/op/plugins.sh:
      relink: true
      path: config/op/plugins.sh
    ~/.config/op/plugins:
      relink: true
      path: config/op/plugins
    # Scripts
    ~/.local/bin:
      glob: true
      path: local/bin/*
      exclude: [local/bin/fzf]
    ~/.local/fzf:
      glob: true
      path: config/fzf/*
    # Manuals
    ~/.local/man:
      glob: true
      path: local/man/**
    ~/.local/share:
      glob: true
      path: local/share/*
    # SSH Configuration
    ~/.ssh/:
      glob: true
      mode: 0600
      path: ssh/*

- shell:
    # Add Git submodules and remove old ones
    - bash add-submodules.sh || true
    # Update submodules recursively
    - git submodule update --init --recursive --force

- shell:
    # Use my dotfiles manager to install everything
    - bash local/bin/dfm install all

- pipx:
    file: tools/requirements-pipx.txt
    stdout: true
    stderr: true
