Logs for my internship @ LAAS-CNRS
1#!/usr/bin/env pwsh
2# PowerShell equivalent of the provided Fish script
3
4git checkout -- rapport/main.pdf
5git pull --rebase --autostash
6
7while ($true) {
8 # Get page count using mutool instead of pdfinfo
9 $pageCount = & mutool info rapport/main.pdf |
10 Select-String '^Pages:' |
11 ForEach-Object { ($_ -split '\s+')[-1] }
12
13 $pageCount > pages_count
14
15 # Check for changes in relevant files
16 git diff --no-patch --exit-code slides/*.typ slides/*.dot slides/*.png rapport/*.typ rapport/*.dot rapport/*.png bib.yaml | Out-Null
17 $pdfChanges = $LASTEXITCODE
18
19 Write-Host "PDF updates with these changes: $pdfChanges"
20
21 # Stage relevant files
22 git add rapport/ slides/ bib.yaml *.fish *.ps1 pages_count
23 git commit --quiet -m "Continue rapport"
24
25 # Push if there were changes
26 if ($pdfChanges -ne 0) {
27 git push --quiet --force
28 Write-Host "Pushed at $(Get-Date)"
29 }
30
31 Start-Sleep -Seconds (60 * 30)
32}