zmodyfikuj ten kod, aby kompresował podany plik przy wejściu i zapisywał plik skompresowany na wyjściu , używając do tego odpowiedniej flagi

package main

import (
	"compress/lzw"
	"flag"
	"fmt"
	"io"
	"os"
)

func main() {
	addFlag := flag.Bool("a", false, "Add file to archive”)
	deleteFlag := flag.Bool("d", false, "Delete file from archive”)
	selfExtractingFlag := flag.Bool("s", false, "Make a self-extracting archive”)
	updateFlag := flag.Bool("u", false, "Update file to archive”)
	moveFlag := flag.Bool("m", false, "Move new file into archive”)
	extractFlag := flag.Bool("e", false, "Extract files from archive”)
	extractFlag2 := flag.Bool("x", false, "Extract files from archive”) // Using naming convention e,x for extract
	listFlag := flag.Bool("l", false, "View list of files in archive”)
	testFlag := flag.Bool("t", false, "Test integrity of archive”)
	helpFlag := flag.Bool("h", false, "View help screen”)

	flag.Parse()

	if *addFlag {
		fmt.Println(“Add file to archive”)
		// Add file to archive logic here
	} else if *deleteFlag {
		fmt.Println(“Delete file from archive”)
		// Delete file from archive logic here
	} else if *selfExtractingFlag {
		fmt.Println(“Make a self-extracting archive”)
		// Make a self-extracting archive logic here
	} else if *updateFlag {
		fmt.Println(“Update file to archive”)
		// Update file to archive logic here
	} else if *moveFlag {
		fmt.Println(“Move new file into archive”)
		// Move new file into archive logic here
	} else if *extractFlag || *extractFlag2 {
		fmt.Println(“Extract files from archive”)
		// Extract files from archive logic here
	} else if *listFlag {
		fmt.Println(“View list of files in archive”)
		// View list of files in archive logic here
	} else if *testFlag {
		fmt.Println(“Test integrity of archive”)
		// Test integrity of archive logic here
	} else if *helpFlag {
		printHelp()
	} else {
		fmt.Println(“No valid flag provided. Use -h flag for help.”)
	}
}

func printHelp() {
	fmt.Println(“Help:”)
	fmt.Println(“-a: Add file to archive”)
	fmt.Println(“-d: Delete file from archive”)
	fmt.Println(“-s: Make a self-extracting archive”)
	fmt.Println(“-u: Update file to archive”)
	fmt.Println(“-m: Move new file into archive”)
	fmt.Println(“-e, -x: Extract files from archive”)
	fmt.Println(“-l: View list of files in archive”)
	fmt.Println(“-t: Test integrity of archive”)
	fmt.Println(“-h: View help screen”)
}

func addFileToArchive(file string) {
	archiveFile, err := os.Create(“archive.lzw”)
	if err != nil {
		fmt.Println(“Error creating archive file:”, err)
		return
	}
	defer archiveFile.Close()

	archiveWriter := lzw.NewWriter(archiveFile, lzw.LSB, 8)
	defer archiveWriter.Close()

	fileToArchive, err := os.Open(file)
	if err != nil {
		fmt.Println(“Error opening file:”, err)
		return
	}
	defer fileToArchive.Close()

	_, err = io.Copy(archiveWriter, fileToArchive)
	if err != nil {
		fmt.Println(“Error copying file to archive:”, err)
		return
	}

	fmt.Println(“File added to archive successfully”)
}

func extractFilesFromArchive() {
	archiveFile, err := os.Open(“archive.lzw”)
	if err != nil {
		fmt.Println(“Error opening archive file:”, err)
		return
	}
	defer archiveFile.Close()

	archiveReader := lzw.NewReader(archiveFile, lzw.LSB, 8)
	defer archiveReader.Close()

	_, err = io.Copy(os.Stdout, archiveReader)
	if err != nil {
		fmt.Println(“Error extracting files from archive:”, err)
		return
	}

	fmt.Println(“Files extracted from archive successfully”)
}