commit ec8f1d2754e8de27943408bac3603ceae1500d52 from: Benjamin Stürz date: Wed Dec 27 22:11:26 2023 UTC Add Makefile and got-archive.1 commit - db6c077fdc0951c3e3dfb092d0cf7eac52da2be4 commit + ec8f1d2754e8de27943408bac3603ceae1500d52 blob - f1b7f9e6c0d5d9d35f3f6372ae6a5448bb3fa043 blob + ccf7f2afa09b047024cc66b4fc65ae3fb7986fd6 --- got-archive +++ got-archive @@ -8,10 +8,10 @@ die() { } usage() { - die 1 "Usage: got-archive [-s] [-b branch/tag] [-o outdir] [-t tmpdir] repo" + die 1 "Usage: got-archive [-sV] [-b branch/tag] [-o outdir] [-t tmpdir] repo" } -args=$(getopt b:o:st: $*) +args=$(getopt b:o:st:V $*) [ $? -ne 0 ] && usage set -- $args @@ -42,14 +42,14 @@ while [ $# -ne 0 ]; do shift shift ;; + -V) + echo "got-archive-@VERSION@" + exit 1 + ;; --) shift break ;; - *) - shift - exit 1 - ;; esac done blob - /dev/null blob + f1f5576a2241656cb1d22c1b097f68517ab7676e (mode 644) --- /dev/null +++ Makefile @@ -0,0 +1,15 @@ +.POSIX: +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/man +VERSION = 0.1 + +all: + +install: + mkdir -p ${DESTDIR}${PREFIX}/bin ${DESTDIR}${MANPREFIX}/man1 + sed 's/@VERSION@/${VERSION}/' got-archive > ${DESTDIR}${PREFIX}/bin/got-archive + chmod 755 ${DESTDIR}${PREFIX}/bin/ + cp -f got-archive.1 ${DESTDIR}${MANPREFIX}/man1/ + +uninstall: + rm -f ${DESTDIR}${PREFIX}/bin/got-archive blob - /dev/null blob + cb87696a1e81a2bf65ce8c198250812083fb8941 (mode 644) --- /dev/null +++ got-archive.1 @@ -0,0 +1,71 @@ +.\" +.\" Copyright (c) 2023 Benjamin Stürz +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate$ +.Dt GOT-ARCHIVE 1 +.Os +.Sh NAME +.Nm got-archive +.Nd git-archive(1) clone for got-archive(1) +.Sh SYNOPSIS +.Nm got-archive +.Op Fl sV +.Op Fl b Ar branch/tag +.Op Fl o Ar outdir +.Op Fl t Ar tmpdir +.Ar repo +.Sh DESCRIPTION +.Nm +is a small helper script for got(1) useful for creating tarballs of repositories. +.Pp +The options are as follows: +.Bl -tag -width -Ds +.Ar branch/tag . +.It Fl b Ar branch/tag +Specify a branch or tag. +By default, the default branch of the repository is selected (eg. master or main). +.It Fl o Ar outdir +An existing directory in which the tarball will be created. +By default, this will be the current working directory. +.It Fl s +Strip a preceding "v" from the +.Ar branch/tag . +.It Fl t Ar tmpdir +A temporary directory used for the checkout. +By default, this will be +.Ar /tmp/got-archive . +.It Fl V +Print the version of got-archive(1) and exit. +.Sh EXIT STATUS +.Ex -std got-archive +.Sh EXAMPLES +Create a tarball for +.Pa /var/git/example.git . +.Pp +.Dl $ got-archive /var/git/example.git +.Pp +Create a tarball for tag v1.0 of +.Pa /var/git/example.git +and put the resulting +.Pa example-1.0.tgz +into +.Pa /mnt . +.Pp +.Dl $ got-archive -s -b v1.0 -o /mnt /var/git/example.git +.Sh SEE ALSO +.Xr got 1 , +.Xr tar 1 +.Sh AUTHORS +.An Benjamin Stürz Aq Mt benni@stuerz.xyz