From fa01493c11a10050e9a79daae84ce3e66c74f037 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sat, 14 Dec 2024 21:04:16 +0100 Subject: fix(pkgs/stamp): Streamline and update to work with reuse v5.0.x --- pkgs/by-name/st/stamp/package.nix | 1 + pkgs/by-name/st/stamp/stamp.sh | 60 +++++++++++++++++++++++---------------- 2 files changed, 36 insertions(+), 25 deletions(-) (limited to 'pkgs/by-name') diff --git a/pkgs/by-name/st/stamp/package.nix b/pkgs/by-name/st/stamp/package.nix index f39e2197..703f73e3 100644 --- a/pkgs/by-name/st/stamp/package.nix +++ b/pkgs/by-name/st/stamp/package.nix @@ -10,6 +10,7 @@ sysLib.writeShellScript { src = ./stamp.sh; generateCompletions = false; keepPath = false; + dependencies = [ findutils fd diff --git a/pkgs/by-name/st/stamp/stamp.sh b/pkgs/by-name/st/stamp/stamp.sh index c3697c99..0fced956 100755 --- a/pkgs/by-name/st/stamp/stamp.sh +++ b/pkgs/by-name/st/stamp/stamp.sh @@ -5,49 +5,48 @@ SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH help() { cat <" \ - --copyright-style string-c \ - --template default \ - --fallback-dot-license \ - --license "$license" "$1" - else - reuse annotate \ - --copyright "$(git config --get user.name) <$(git config --get user.email)>" \ - --copyright-style string-c \ - --fallback-dot-license \ - --license "$license" "$1" + template="--template=default" fi + + reuse annotate \ + --copyright="$copyright" \ + --copyright-prefix=string-c $template \ + --fallback-dot-license \ + --license="$license" -- "$1" } for arg in "$@"; do @@ -62,21 +61,32 @@ done [ "$(git rev-parse --is-inside-work-tree)" = "true" ] || die "You need to be in a git directory" run=true +license="GPL-3.0-or-later" +copyright="$(git config --get user.name) <$(git config --get user.email)>" while [ "$#" -gt 0 ] && [ "$run" = true ]; do case "$1" in "--license" | "-l") shift 1 license="$1" - [ "$license" ] || die "No license specified. See --help for more." + [ "$license" ] || die "No license specified. See --help for usage." shift 1 ;; - "copyright" | "c") + "--copyright" | "-c") + shift 1 + copyright="$1" + [ "$copyright" ] || die "No copyright string specified. See --help for usage." shift 1 - # The files should now be in $@ + ;; + "--") run=false + shift 1 + ;; + -*) + die "Unknown option: '$1' (if you intented this to be a path use '--' before it.)" ;; *) - die "Unknown command: $1" + # We reached the end of the options. + run=false ;; esac done -- cgit 1.4.1