You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: archive.go
    path of file: ./repos/sealos/cmd/sealctl/cmd
    
    the code of the file until where you have to start completion: // Copyright Â© 2023 sealos.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS"
    
func newTarCmd() *cobra.Command {
	var (
		compressionF flags.Compression
		output       string
		clear        bool
	)
	cmd := &cobra.Command{
		Use:           "tar",
		Short:         "creates an archive file from the directory at `path`, note that this will strip the parent dir",
		Args:          cobra.ExactArgs(1),
		SilenceErrors: true,
		RunE: func(cmd *cobra.Command, args []string) error {
			return archive.Tar(args[0], output, compressionF, clear)
		},
	}
	cmd.Flags().Var(&compressionF, "compression", "compression algorithm, available options are tar/gzip/zstd/disable")
	cmd.Flags().StringVarP(&output, "output", "o", "", "path of archive file")
	cmd.Flags().BoolVar(&clear, "clear", false, "remove source after compression finished")
	_ = cmd.MarkFlagRequired("output")
	_ = cmd.MarkFlagRequired("compression")
	return cmd
}