MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / ModuleProgressBar

Class ModuleProgressBar

codewiki/cli/utils/progress.py:176–221  ·  view source on GitHub ↗

Progress bar for module-by-module generation.

Source from the content-addressed store, hash-verified

174 verbose: Enable verbose output
175 """
176 self.total_modules = total_modules
177 self.current_module = 0
178 self.verbose = verbose
179 self.bar = None
180
181 if not verbose:
182 self.bar = click.progressbar(
183 length=total_modules,
184 label="Generating modules",
185 show_eta=True,
186 show_percent=True,
187 )
188 self.bar.__enter__()
189
190 def update(self, module_name: str, cached: bool = False):
191 """
192 Update progress for a module.
193
194 Args:
195 module_name: Name of the module
196 cached: Whether the module was loaded from cache
197 """
198 self.current_module += 1
199
200 if self.verbose:
201 status = "✓ (cached)" if cached else "⟳ (generating)"
202 click.echo(f" [{self.current_module}/{self.total_modules}] {module_name}... {status}")
203 elif self.bar:
204 self.bar.update(1)
205
206 def finish(self):
207 """Finish progress bar."""
208 if self.bar:
209 self.bar.__exit__(None, None, None)
210 self.bar = None

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected