@@ -43,6 +43,8 @@ def invoke(self, args):
4343 if args .restore :
4444 self .restore ()
4545 else :
46+ if any ([args .github_token , args .gitee_token ]):
47+ self .__update_access_token (args .github_token , args .gitee_token )
4648 if any ([args .suffix_reset , args .comment_reset , args .ignore_reset ]):
4749 self .__reset_config (args .suffix_reset , args .comment_reset , args .ignore_reset )
4850 if any ([args .suffix_add , args .comment_add , args .ignore_add ]):
@@ -59,6 +61,16 @@ def __confirm(self, tips):
5961 check = input (tips )
6062 return check .strip ().lower () == 'y'
6163
64+ def __update_access_token (self , github_access_token , gitee_access_token ):
65+ if github_access_token :
66+ if self .__confirm ("the old Github access token will be updated to `{}` . (y/n) " .format (github_access_token )):
67+ self .access_tokens .github = github_access_token
68+ if gitee_access_token :
69+ if self .__confirm ("the old Gitee access token will be updated to `{}` . (y/n) " .format (gitee_access_token )):
70+ self .access_tokens .gitee = gitee_access_token
71+
72+ self .__update ()
73+
6274 def __reset_config (self , suffix_reset , comment_reset , ignore_reset ):
6375 if suffix_reset :
6476 if self .__confirm ("'suffix' will be replaced with {} . (y/n) " .format (suffix_reset )):
@@ -146,11 +158,11 @@ def request_gitee_access_token(self):
146158 print ('======================\n ' )
147159
148160 def restore (self ):
149- self .suffix = {"c" , "cc" , "clj" , "cpp" , "cs" , "cu" , "cuh" , "dart" , "go" , "h" , "hpp" , "java" , "jl" , "js" , "kt " ,
150- "lisp" , "lua" , "pde" , "m" , "php" , "py" , "R " , "rb" , "rs" , "rust " , "sh" , "scala" , "swift" , "ts" ,
161+ self .suffix = {"asm" , " c" , "cc" , "clj" , "cpp" , "cs" , "cu" , "cuh" , "dart" , "go" , "h" , "hpp" , "java" , "jl" , "js" ,
162+ "kt" , " lisp" , "lua" , "pde" , "m" , "php" , "py" , "r " , "rb" , "rs" , "sh" , "scala" , "swift" , "ts" ,
151163 "vb" }
152- self .comment = {"#" , "//" , "/*" , "*" , "*/ " , ": " , ";" , '""""' }
153- self .ignore = {"out" , " venv" , ".git" , ".idea" , "build" , "target" , "node_modules" , ".vscode" , "dist" }
164+ self .comment = {"#" , "//" , "/*" , "*" , ": " , "; " , '--' , ';' , '%' , "'" }
165+ self .ignore = {"venv" , ".git" , ".idea" , "build" , "target" , "node_modules" , ".vscode" , "dist" }
154166
155167 if self .__confirm ('The default configuration will be restored. (y/n) ' ):
156168 self .__update ()
0 commit comments