def main()

in src/process_input.py [0:0]


def main(argv: List[str]) -> int:
    flags = ScreenFlags.init_from_args(argv[1:])
    if flags.get_is_clean_mode():
        print("Cleaning out state files...")
        for file_path in state_files.get_all_state_files():
            if os.path.isfile(file_path):
                os.remove(file_path)
        print(f"Done! Removed {len(state_files.get_all_state_files())} files ")
        return 0
    if sys.stdin.isatty():
        # don't keep the old selection if the --keep-open option is used;
        # otherwise you need to manually clear the old selection every
        # time fpp is reopened.
        if flags.get_keep_open():
            # delete the old selection
            selection_path = state_files.get_selection_file_path()
            if os.path.isfile(selection_path):
                os.remove(selection_path)
        if os.path.isfile(state_files.get_pickle_file_path()):
            print("Using previous input piped to fpp...")
        else:
            usage()
        # let the next stage parse the old version
    else:
        # delete the old selection
        selection_path = state_files.get_selection_file_path()
        if os.path.isfile(selection_path):
            os.remove(selection_path)
        do_program(flags)
    return 0