test-ly-files: Display symlink creation, add `-v` to `ln`
[sunny256-utils.git] / poiformat
blob16a4f6d08bc429d83a7ee56c2eed3843b0c5b0cb
1 #!/usr/bin/env bash
3 # poiformat
4 # File ID: bcf111dc-7683-11e0-9799-01b466beaad8
6 progname=poiformat
8 if [ "$1" = "-g" ]; then
9 shift
10 else
11 cat "$@" | xf | roundgpx | latlon | wpt-dupdesc | wpt-rmsym | xf | sortxml -r -s wpt -u
12 exit
15 files="$@"
16 branch=$progname.$(date -u +"%Y%m%dT%H%M%SZ")
18 commit() {
19 msg="$*"
20 stat1=$(git status --short $files)
21 if [ -z "$stat1" ]; then
22 echo $progname: No changes, skipping commit \"$msg\"
23 return;
25 git add $files
26 git commit -m "$msg$(echo; echo; suuid -t c_poiformat -c "$msg")"
29 git checkout -b $branch
30 filt xf $files || {
31 echo $progname: XML error >&2;
32 git checkout -;
33 git branch -d $branch;
34 exit 1;
36 commit "$progname filtered files through xf"
37 filt roundgpx $files
38 commit "$progname filtered files through roundgpx"
39 filt latlon $files
40 commit "$progname filtered files through latlon"
41 filt wpt-dupdesc $files
42 commit "$progname filtered files through wpt-dupdesc"
43 filt wpt-rmsym $files
44 commit "$progname filtered files through wpt-rmsym"
45 filt xf $files
46 commit "$progname filtered files through xf"
47 filt "sortxml -r -s wpt" $files
48 commit "$progname filtered files through sortxml -r -s wpt"
49 filt "sortxml -r -s wpt -u" $files
50 commit "$progname removed duplicate waypoints"
51 git checkout -
52 git merge --no-ff --edit -m "Merge branch '$branch' created by $progname" $branch
53 git branch -d $branch