/ de-omarchy / bin / omarchy-dev-add-migration
swadhinbiswas Initial de-omarchy: Omarchy UI layer for Arch-based distros · 8/22/2026
9f393b2
42 lines · 851 Bytes
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
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash

# omarchy:summary=Create a new Omarchy migration in the current source tree.
# omarchy:args=[--no-edit]

set -euo pipefail

no_edit=0

while (($#)); do
  case "$1" in
    --no-edit)
      no_edit=1
      shift
      ;;
    system|user)
      echo "omarchy-dev-add-migration: migration scopes are no longer used; creating a regular migration." >&2
      shift
      ;;
    -h|--help)
      echo "Usage: omarchy-dev-add-migration [--no-edit]"
      exit 0
      ;;
    *)
      echo "Unknown option: $1" >&2
      echo "Usage: omarchy-dev-add-migration [--no-edit]" >&2
      exit 1
      ;;
  esac
done

cd "${OMARCHY_PATH:-$(pwd)}"
mkdir -p migrations
migration_file="migrations/$(git log -1 --format=%cd --date=unix).sh"
touch "$migration_file"

if (( ! no_edit )); then
  nvim "$migration_file"
fi

printf '%s\n' "$PWD/$migration_file"