about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xlicensor9
1 files changed, 8 insertions, 1 deletions
diff --git a/licensor b/licensor index b5795ae..5e784bb 100755 --- a/licensor +++ b/licensor
@@ -69,6 +69,7 @@ main() {
69 __year="$(date +%Y)" 69 __year="$(date +%Y)"
70 __author="$(guess_author)" 70 __author="$(guess_author)"
71 __email="$(guess_email)" 71 __email="$(guess_email)"
72 _converter=license_convert
72 73
73 while getopts hlLs:fzZpPqy:a:e:o:w:c: opt; do 74 while getopts hlLs:fzZpPqy:a:e:o:w:c: opt; do
74 case "$opt" in 75 case "$opt" in
@@ -77,6 +78,7 @@ main() {
77 l) list_licenses && exit || exit $? ;; 78 l) list_licenses && exit || exit $? ;;
78 L) list_licenses -f && exit || exit $? ;; 79 L) list_licenses -f && exit || exit $? ;;
79 s) search_licenses "$OPTARG" ;; 80 s) search_licenses "$OPTARG" ;;
81 c) _converter=lcat ;;
80 # flags 82 # flags
81 f) _force=true ;; 83 f) _force=true ;;
82 z) _fold=1 ;; 84 z) _fold=1 ;;
@@ -111,11 +113,16 @@ main() {
111 fi 113 fi
112 114
113 license_file="$(get_license "$__license")" || exit $? 115 license_file="$(get_license "$__license")" || exit $?
114 license_convert <"$LICENSOR_CACHE/$license_file.template.txt" \ 116 $_converter <"$LICENSOR_CACHE/$license_file.template.txt" \
115 "$__copyright" "$_optional" "$_fold" "$__width" >"$__output" 117 "$__copyright" "$_optional" "$_fold" "$__width" >"$__output"
116 [ "$__output" != /dev/stdout ] && log "$__license license written to $__output." 118 [ "$__output" != /dev/stdout ] && log "$__license license written to $__output."
117} 119}
118 120
121lcat() {
122 set --
123 cat -
124}
125
119get_licenses() { 126get_licenses() {
120 # Get licenses from cache, or download them 127 # Get licenses from cache, or download them
121 if ! [ -d "$LICENSOR_CACHE" ] || [ "x$1" = "x-f" ]; then 128 if ! [ -d "$LICENSOR_CACHE" ] || [ "x$1" = "x-f" ]; then