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 1
1
#! /bin/bash
2
2
set -e
3
3
4
- AUTHOR=" Hao Chen "
4
+ AUTHOR=" NOBODY "
5
5
LEETCODE_URL=https://leetcode.com/problems/
6
6
LEETCODE_NEW_URL=https://leetcode.com/problems/
7
7
LEETCODE_OLD_URL=https://oj.leetcode.com/problems/
@@ -23,6 +23,18 @@ function usage()
23
23
echo -e " "
24
24
}
25
25
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
+
26
38
function detect_os()
27
39
{
28
40
platform=' unknown'
@@ -138,6 +150,9 @@ if [ ! -s $source_file ]; then
138
150
echo " " > $source_file
139
151
fi
140
152
153
+ # detect the author name
154
+ get_author_name;
155
+
141
156
# adding the Copyright Comments
142
157
if ! grep -Fq " ${COMMENT_TAG} Author :" $source_file ; then
143
158
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