Common documentation and files across my projects
1#!/usr/bin/env nu
2# SPDX-License-Identifier: AGPL-3.0-only
3# SPDX-FileCopyrightText: 2025 @matrixfurry.com <did:plc:zmjoeu3stwcn44647rhxa44o>
4
5use std log
6
7const common = path self ../../
8
9def main [
10 --update-license
11 --commit (-c)
12] {
13 if $commit and (jj status | lines | first) != "The working copy has no changes." {
14 error make {
15 msg: "the working copy has changes"
16 help: "create an empty commit before updating files"
17 }
18 }
19
20 cp -r ($common | path join docs) .
21 log info "updated common project files"
22
23 if $update_license or not ("./LICENSE" | path exists) {
24 cp -r ($common | path join LICENSE) .
25 log warning "updated project license"
26 }
27
28 if $commit {
29 jj commit -m "docs: update shared documentation"
30 }
31}