]> Cypherpunks.ru repositories - prepro.git/blob - mk-goget
Initial commit
[prepro.git] / mk-goget
1 #!/usr/bin/env zsh
2
3 set -e
4
5 vcsurl=$1
6 modname=$2
7
8 cols=(${(s#/#)modname})
9 [[ ${cols[-1]} =~ v[0-9]+ ]] || cols=($cols v1)
10 moddir=${(j:/:)cols[1,-2]}
11 v=${cols[-1]}
12 [[ -s $moddir/$v ]] && exit
13 mkdir -p $moddir
14 cat > $moddir/$v <<EOF
15 <!DOCTYPE html>
16 <html>
17 <head>
18 <meta name="go-import" content="$modname mod https://proxy.${cols[1]}">
19 <head>
20 <body>
21 <a href="$vcsurl">$modname</a>
22 </body>
23 </html>
24 EOF