#!/usr/bin/python2.7 import sys import os def remove_checked_items(file_path): try: with open(file_path, 'r') as file: lines = file.readlines() with open(file_path, 'w') as file: for line in lines: if not line.startswith("- [x]"): file.write(line) except FileNotFoundError: sys.stderr.write("File not found: {}".format(file_path)) except Exception as e: sys.stderr.write("An error occurred: {}".format(str(e))) if __name__ == "__main__": if len(sys.argv) != 2: print("Usage: python remove_checked_items.py ") else: #if os.environ.get('REMOVE_CHECKED') is not None: file_path = sys.argv[1] remove_checked_items(file_path) #else: # print("No environment variable set to define behavior")