diff --git a/client/fabric b/client/fabric index 57e1b93..b1fe682 100755 --- a/client/fabric +++ b/client/fabric @@ -28,7 +28,7 @@ if __name__ == "__main__": parser.add_argument( "--stream", "-s", - help="Use this option if you are piping output to another app. The output will not be streamed", + help="Use this option if you want to see the results in realtime. NOTE: You will not be able to pipe the output into another command.", action="store_true", ) parser.add_argument( diff --git a/client/utils.py b/client/utils.py index 53ba6f8..c2d3db5 100644 --- a/client/utils.py +++ b/client/utils.py @@ -121,23 +121,25 @@ class Update: def __init__(self): self.root_api_url = "https://api.github.com/repos/danielmiessler/fabric/contents/patterns?ref=main" self.config_directory = os.path.expanduser("~/.config/fabric") - self.pattern_directory = os.path.join( - self.config_directory, "patterns") + self.pattern_directory = os.path.join(self.config_directory, "patterns") os.makedirs(self.pattern_directory, exist_ok=True) self.update_patterns() # Call the update process from a method. def update_patterns(self): try: - self.progress_bar = tqdm(desc="Downloading files", unit="file") + self.progress_bar = tqdm(desc="Downloading Patterns…", unit="file") self.get_github_directory_contents( - self.root_api_url, self.pattern_directory) + self.root_api_url, self.pattern_directory + ) # Close progress bar on success before printing the message. self.progress_bar.close() except HTTPError as e: # Ensure progress bar is closed on HTTPError as well. self.progress_bar.close() if e.response.status_code == 403: - print("GitHub API rate limit exceeded. Please wait before trying again.") + print( + "GitHub API rate limit exceeded. Please wait before trying again." + ) sys.exit() else: print(f"Failed to download patterns due to an HTTP error: {e}") @@ -156,8 +158,9 @@ class Update: def process_item(self, item, local_dir): if item["type"] == "file": - self.download_file(item["download_url"], - os.path.join(local_dir, item["name"])) + self.download_file( + item["download_url"], os.path.join(local_dir, item["name"]) + ) elif item["type"] == "dir": new_dir = os.path.join(local_dir, item["name"]) os.makedirs(new_dir, exist_ok=True) @@ -172,18 +175,18 @@ class Update: self.process_item(item, local_dir) except HTTPError as e: if e.response.status_code == 403: - print("GitHub API rate limit exceeded. Please wait before trying again.") + print( + "GitHub API rate limit exceeded. Please wait before trying again." + ) self.progress_bar.close() # Ensure the progress bar is cleaned up properly else: - print( - f"Failed to fetch directory contents due to an HTTP error: {e}") + print(f"Failed to fetch directory contents due to an HTTP error: {e}") class Setup: def __init__(self): self.config_directory = os.path.expanduser("~/.config/fabric") - self.pattern_directory = os.path.join( - self.config_directory, "patterns") + self.pattern_directory = os.path.join(self.config_directory, "patterns") os.makedirs(self.pattern_directory, exist_ok=True) self.env_file = os.path.join(self.config_directory, ".env")