@@ -707,36 +707,86 @@ def parse_args():
707707 return parser .parse_args ()
708708
709709
710- def main ():
711- args = parse_args ()
712-
713- if args .compare and len (args .refs ) % 2 == 1 :
710+ def deptool (
711+ compare ,
712+ refs ,
713+ repo_path ,
714+ no_info ,
715+ json_path ,
716+ cdx_sbom_path_template ,
717+ patch ,
718+ skip_unchanged ,
719+ ):
720+ if compare and len (refs ) % 2 == 1 :
714721 log .warning ("comparing with an odd number of versions" )
715722
716- dr = DepsReader (repo_path = args . repo_path , log_info = not args . no_info )
723+ dr = DepsReader (repo_path = repo_path , log_info = not no_info )
717724
718- if args . json_path :
719- dr .write_deps_json (args . json_path , args . refs )
725+ if json_path :
726+ dr .write_deps_json (json_path , refs )
720727
721- if args . cdx_sbom_path_template :
722- dr .write_cdx_sboms (args . cdx_sbom_path_template , args . refs )
728+ if cdx_sbom_path_template :
729+ dr .write_cdx_sboms (cdx_sbom_path_template , refs )
723730
724- if args . patch or not args . compare :
731+ if patch or not compare :
725732 updated_readme , updated_agent_table , updated_hub_table = (
726- dr .updated_deps_markdown_table (args . refs )
733+ dr .updated_deps_markdown_table (refs )
727734 )
728735
729- if args . compare :
730- comparison_table = dr .comparison_md_table (args . refs , args . skip_unchanged )
736+ if compare :
737+ comparison_table = dr .comparison_md_table (refs , skip_unchanged )
731738 print (comparison_table )
732739 else :
733740 print ("### Agent dependencies\n " )
734741 print (updated_agent_table )
735742 print ("\n ### Enterprise Hub dependencies\n " )
736743 print (updated_hub_table )
737744
738- if args . patch :
745+ if patch :
739746 dr .patch_readme (updated_readme )
747+ return 0
748+
749+
750+ def main () -> int :
751+ args = parse_args ()
752+ return deptool (
753+ compare = args .compare ,
754+ refs = args .refs ,
755+ repo_path = args .repo_path ,
756+ no_info = args .no_info ,
757+ json_path = args .json_path ,
758+ cdx_sbom_path_template = args .cdx_sbom_path_template ,
759+ patch = args .patch ,
760+ skip_unchanged = args .skip_unchanged ,
761+ )
762+
763+
764+ def update_dependency_tables () -> int :
765+ deptool (
766+ compare = False ,
767+ refs = ACTIVE_BRANCHES ,
768+ repo_path = "." ,
769+ no_info = False ,
770+ json_path = None ,
771+ cdx_sbom_path_template = None ,
772+ patch = True ,
773+ skip_unchanged = False ,
774+ )
775+ return 0
776+
777+
778+ def print_release_dependency_tables (versions ) -> int :
779+ deptool (
780+ compare = True ,
781+ refs = versions ,
782+ repo_path = "." ,
783+ no_info = False ,
784+ json_path = None ,
785+ cdx_sbom_path_template = None ,
786+ patch = False ,
787+ skip_unchanged = True ,
788+ )
789+ return 0
740790
741791
742792if __name__ == "__main__" :
0 commit comments