@@ -203,6 +203,21 @@ def generate_markdown_content(
203203 return content
204204
205205
206+ def get_cache_path (tool_name : str , command_type : str ) -> Path :
207+ """
208+ get cache file path for a command output.
209+
210+ Args:
211+ tool_name: tool name (e.g., "syft", "grype")
212+ command_type: type of command (e.g., "version", "config")
213+
214+ Returns:
215+ Path to cache file
216+ """
217+ cache_dir = config .paths .reference_cache_dir / tool_name / command_type
218+ return cache_dir / "output.txt"
219+
220+
206221def get_cache_path_for_cli (tool_name : str , cmd_parts : list [str ]) -> Path :
207222 """
208223 get cache file path for a CLI command output.
@@ -310,10 +325,10 @@ def get_subcommands(image: str, cmd_parts, tool_name: str, update: bool = False)
310325
311326def get_version_info (image : str , tool_name : str , update : bool = False ) -> str :
312327 """Get version information from the app."""
313- cache_path = get_cache_path_for_cli (tool_name , [ "version" ] )
328+ cache_path = get_cache_path (tool_name , "version" )
314329 app_version = version .get_app_version (image , tool_name , cache_path , update )
315330
316- if app_version is None :
331+ if app_version is None or app_version == "unknown" :
317332 raise RuntimeError (f"Failed to retrieve version info from the image '{ image } '." )
318333
319334 return app_version
0 commit comments