"""Command dispatcher for the energy measurement tool."""importargparsefromenergytrackr.pipeline.pipelineimportmeasurefromenergytrackr.plot.pipelineimportplotfromenergytrackr.utils.exceptionsimportUnknownCommandErrorfromenergytrackr.utils.sortimportreorder_commits
[docs]defhandle_command(args:argparse.Namespace)->None:"""Handle the CLI command based on the parsed arguments. Args: args (argparse.Namespace): Parsed command-line arguments. Raises: UnknownCommandError: If the command is not recognized. """matchargs.command:case"measure":# Measure energy consumptionmeasure(args.config)case"sort":# Sort a result filereorder_commits(args.file,args.repo_path,args.output_file)case"plot":# Plot a result fileplot(args.file,args.repo_path)case_:raiseUnknownCommandError(args.command)