import argparse # Default path from settings DEFAULT_PATH = "/default/path" # Define functions for each action def action_one(path): print(f"Performing Action One with path: {path}") def action_two(path): print(f"Performing Action Two with path: {path}") def action_three(path): print(f"Performing Action Three with path: {path}") # Map actions to their corresponding functions ACTIONS = { "action_one": action_one, "action_two": action_two, "action_three": action_three, } def main(): # Set up argument parser parser = argparse.ArgumentParser( description="Perform actions in a specified order." ) # Add a --path argument to overwrite the default path parser.add_argument( "--path", type=str, default=DEFAULT_PATH, help="Path to use for actions (overwrites default path).", ) # Add arguments for each action parser.add_argument( "actions", nargs="+", # Allow one or more actions to be specified choices=ACTIONS.keys(), # Restrict to valid actions help="List of actions to perform in order. Choices: " + ", ".join(ACTIONS.keys()), ) # Parse arguments args = parser.parse_args() # Execute actions in the specified order for action in args.actions: ACTIONS[action](args.path) if __name__ == "__main__": main()