File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22set -e
33
4- AUTHOR=" Hao Chen "
4+ AUTHOR=" NOBODY "
55LEETCODE_URL=https://leetcode.com/problems/
66LEETCODE_NEW_URL=https://leetcode.com/problems/
77LEETCODE_OLD_URL=https://oj.leetcode.com/problems/
@@ -23,6 +23,18 @@ function usage()
2323 echo -e " "
2424}
2525
26+ function get_author_name()
27+ {
28+ TRUE_CMD=` which true`
29+ git=` type -P git || ${TRUE_CMD} `
30+ if [ ! -z " ${git} " ]; then
31+ AUTHOR=` git config --get user.name`
32+ else
33+ AUTHOR=` whoami`
34+ fi
35+ }
36+
37+
2638function detect_os()
2739{
2840 platform=' unknown'
@@ -138,6 +150,9 @@ if [ ! -s $source_file ]; then
138150 echo " " > $source_file
139151fi
140152
153+ # detect the author name
154+ get_author_name;
155+
141156# adding the Copyright Comments
142157if ! grep -Fq " ${COMMENT_TAG} Author :" $source_file ; then
143158 sed -i.bak ' 1i\' $' \n ' " ${COMMENT_TAG} Source : ${leetcode_url} " $' \n ' $source_file
You can’t perform that action at this time.
0 commit comments