|
9 | 9 | from typing import List |
10 | 10 | from typing import Sequence |
11 | 11 | from typing import Tuple |
| 12 | +from gitignore_parser import parse_gitignore |
12 | 13 |
|
13 | 14 | from potodo import __version__ |
14 | 15 | from potodo.arguments_handling import check_args |
15 | 16 | from potodo.github import get_issue_reservations |
16 | | -from potodo.ignore import get_ignore_content |
17 | 17 | from potodo.interactive import _confirmation_menu |
18 | 18 | from potodo.interactive import _directory_list_menu |
19 | 19 | from potodo.interactive import _file_list_menu |
@@ -99,15 +99,37 @@ def exec_potodo( |
99 | 99 | :param is_interactive: Switches output to an interactive CLI menu |
100 | 100 | """ |
101 | 101 |
|
102 | | - ignore_file_content = get_ignore_content(repo_path=path) |
103 | | - exclude.extend(ignore_file_content) |
| 102 | + cache_args = { |
| 103 | + "path": path, |
| 104 | + "exclude": exclude, |
| 105 | + "above": above, |
| 106 | + "below": below, |
| 107 | + "only_fuzzy": only_fuzzy, |
| 108 | + "offline": offline, |
| 109 | + "hide_reserved": hide_reserved, |
| 110 | + "counts": counts, |
| 111 | + "json_format": json_format, |
| 112 | + "exclude_fuzzy": exclude_fuzzy, |
| 113 | + "exclude_reserved": exclude_reserved, |
| 114 | + "only_reserved": only_reserved, |
| 115 | + "show_reservation_dates": show_reservation_dates, |
| 116 | + "no_cache": no_cache, |
| 117 | + "is_interactive": is_interactive, |
| 118 | + } |
| 119 | + |
| 120 | + try: |
| 121 | + ignore_matches = parse_gitignore(path / ".potodoignore") |
| 122 | + except FileNotFoundError: |
| 123 | + ignore_matches = parse_gitignore("/dev/null") |
104 | 124 |
|
105 | 125 | # Initialize the arguments |
106 | 126 | issue_reservations = get_issue_reservations(offline, hide_reserved, path) |
107 | 127 |
|
108 | 128 | dir_stats: List[Any] = [] |
109 | 129 | if is_interactive: |
110 | | - directory_options = get_dir_list(repo_path=path, exclude=exclude) |
| 130 | + directory_options = get_dir_list( |
| 131 | + repo_path=path, exclude=exclude, ignore_matches=ignore_matches |
| 132 | + ) |
111 | 133 | while True: |
112 | 134 | selected_dir = _directory_list_menu(directory_options) |
113 | 135 | if selected_dir == (len(directory_options) - 1): |
@@ -139,7 +161,9 @@ def exec_potodo( |
139 | 161 | else: |
140 | 162 | exit() |
141 | 163 | else: |
142 | | - po_files_and_dirs = get_po_stats_from_repo_or_cache(path, exclude, no_cache) |
| 164 | + po_files_and_dirs = get_po_stats_from_repo_or_cache( |
| 165 | + path, exclude, cache_args, ignore_matches, no_cache |
| 166 | + ) |
143 | 167 | for directory_name, po_files in sorted(po_files_and_dirs.items()): |
144 | 168 | # For each directory and files in this directory |
145 | 169 | buffer: List[Any] = [] |
|
0 commit comments