Skip to content

Commit

Permalink
perf: 提高忽略文件的检索效率 & 优化日志
Browse files Browse the repository at this point in the history
  • Loading branch information
laorange committed Dec 9, 2022
1 parent a081834 commit 7df775e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions stoken/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ def execute(self, path: Path = None):
if path is None:
path = BASE_DIR

if self.git_repo is not None and self.git_repo.ignored(path):
print(f"{path.relative_to(BASE_DIR)} has been ignored.")
return
if self.git_repo is not None:
if Path(self.git_repo.git_dir) == path or self.git_repo.ignored(path):
if path.is_dir() or path.suffix in self.config.suffix:
print(f"{path.relative_to(BASE_DIR)} has been ignored.")
return

if path.is_dir():
for file in path.iterdir():
Expand All @@ -145,6 +147,7 @@ def execute(self, path: Path = None):
def main(mode: str, encoding: str, variable_prefix: str, variable_suffix: str, debug: bool, no_git: bool):
stoken = Stoken(mode, encoding, variable_prefix, variable_suffix, debug, no_git)
stoken.execute()
stoken.quit_with_info(f"{Fore.GREEN}stoken: finished!{Fore.RESET}")


if __name__ == '__main__':
Expand Down

0 comments on commit 7df775e

Please sign in to comment.