#!/bin/sh
# this script can be used to check and uncheck org-mode or markdown
# checkboxes. This is to be ran as an ait command.

awk -vline="$1" 'NR == line {
  if ($0 ~ /\[x\]/) {
    sub(/\[x\]/, "[ ]");
  } else {
    sub(/\[ \]/, "[x]");
  }
}
{ print }'
