1. import argparse
  2. import sys
  3. def archive_options():
  4. """Archives command-line options."""
  5. parser = argparse.ArgumentParser(description="Archive command-line options.")
  6. # Define your options here. Example:
  7. parser.add_argument("--input_file", type=str, help="Path to the input file.")
  8. parser.add_argument("--output_dir", type=str, help="Path to the output directory.")
  9. parser.add_argument("--log_level", type=str, default="INFO", help="Logging level.")
  10. args = parser.parse_args()
  11. # Archive the options (e.g., print them to the console or save to a file)
  12. print("Archived Options:")
  13. print(f" Input File: {args.input_file}")
  14. print(f" Output Directory: {args.output_dir}")
  15. print(f" Log Level: {args.log_level}")
  16. # You can save the options to a file if needed:
  17. # with open("options.txt", "w") as f:
  18. # f.write(f"Input File: {args.input_file}\n")
  19. # f.write(f"Output Directory: {args.output_dir}\n")
  20. # f.write(f"Log Level: {args.log_level}\n")
  21. if __name__ == "__main__":
  22. archive_options()

Add your comment