about summary refs log tree commit diff stats
path: root/licenser
diff options
context:
space:
mode:
authorCase Duckworth2020-05-02 20:44:02 -0500
committerCase Duckworth2020-05-02 20:44:39 -0500
commita4a08e75d55ba1c456fd22c8fff94997b5b07b1f (patch)
treea8c303c2274e17463cc7cbf22e80d42a046ff5e7 /licenser
parentWrap license text (diff)
downloadlicensor-a4a08e75d55ba1c456fd22c8fff94997b5b07b1f.tar.gz
licensor-a4a08e75d55ba1c456fd22c8fff94997b5b07b1f.zip
Add force option
Diffstat (limited to 'licenser')
-rwxr-xr-xlicenser8
1 files changed, 6 insertions, 2 deletions
diff --git a/licenser b/licenser index 2bca223..f3e5480 100755 --- a/licenser +++ b/licenser
@@ -7,7 +7,9 @@ __DEFAULT_LICENSE=MIT
7 7
8# entry point 8# entry point
9licenser() { 9licenser() {
10 while getopts hly:a:o: OPT; do 10 _force=false
11
12 while getopts hlfy:a:o: OPT; do
11 case "$OPT" in 13 case "$OPT" in
12 h) 14 h)
13 usage 15 usage
@@ -17,6 +19,7 @@ licenser() {
17 list_licenses 19 list_licenses
18 exit 0 20 exit 0
19 ;; 21 ;;
22 f) _force=true ;;
20 y) __YEAR="$OPTARG-01-01" ;; 23 y) __YEAR="$OPTARG-01-01" ;;
21 a) __AUTHOR="$OPTARG" ;; 24 a) __AUTHOR="$OPTARG" ;;
22 o) __OUTPUT="$OPTARG" ;; 25 o) __OUTPUT="$OPTARG" ;;
@@ -45,7 +48,7 @@ licenser() {
45 exit 2 48 exit 2
46 fi 49 fi
47 50
48 if [[ -e "$__OUTPUT" ]]; then 51 if [[ -e "$__OUTPUT" && ! $_force ]]; then
49 echo "File exists: $__OUTPUT" 52 echo "File exists: $__OUTPUT"
50 exit 3 53 exit 3
51 fi 54 fi
@@ -65,6 +68,7 @@ usage: licenser [-h|-l] [-y YEAR] [-a AUTHOR] [-o FILE] LICENSE
65 68
66 -h show this help and exit 69 -h show this help and exit
67 -l list available licenses and exit 70 -l list available licenses and exit
71 -f overwrite existing license
68 -y YEAR set the copyright date to YEAR 72 -y YEAR set the copyright date to YEAR
69 -a AUTHOR set the copyright holder to AUTHOR 73 -a AUTHOR set the copyright holder to AUTHOR
70 -o FILE output to FILE 74 -o FILE output to FILE