summaryrefslogtreecommitdiff
path: root/Taskfile.yml
blob: 1628de54a68f36ac81a834168246b086e1342e03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# https://taskfile.dev
version: "3"

dotenv:
  - .env

tasks:

  default:
    desc: Prints this message
    cmds:
      - cmd: task --list-all

  day:input:
    desc: Creates the files needed to solve a day of Advent of Code
    requires:
      vars:
        - YEAR
        - DAY
    vars:
      FORMATTED_DAY: '{{if (lt (atoi .DAY) 10)}}0{{.DAY}}{{else}}{{.DAY}}{{end}}'
      URI: https://adventofcode.com/{{.YEAR}}/day/{{.DAY}}/input
      INPUT_DIR: '/.input/{{.YEAR}}'
    cmds:
      - cmd: mkdir --parents {{.INPUT_DIR}}
      - cmd: curl --cookie 'session={{.SESSION}}' {{.URI}} > {{.INPUT_DIR}}/{{.FORMATTED_DAY}}.txt
    silent: true

  git:hooks:
    desc: sets up the githooks for the project
    cmd: git config core.hooksPath .githooks