#!/usr/bin/env dash # shellcheck source=/dev/null 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" fi } for arg in "$@"; do case "$arg" in "--help" | "-h") help exit 0 ;; esac done [ "$(git rev-parse --is-inside-work-tree)" = "true" ] || die "You need to be in a git directory" run=true while [ "$#" -gt 0 ] && [ "$run" = true ]; do case "$1" in "--license" | "-l") shift 1 license="$1" [ "$license" ] || die "No license specified. See --help for more." shift 1 ;; "copyright" | "c") shift 1 # The files should now be in $@ run=false ;; *) die "Unknown command: $1" ;; esac done for file in "$@"; do if [ -d "$file" ]; then fd . "$file" --type file --hidden | while read -r path_file; do reuse_run "$path_file" done else reuse_run "$file" fi done # vim: ft=sh