copy

package
v0.9.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2026 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cobra.Command{
	Use:   "Copy",
	Short: "copy an embedded file to a file system",
	Long:  `returns error status 1 if file not found.`,

	Run: func(cmd *cobra.Command, args []string) {
		clogFs := config.CoreFs()
		srcPath := args[0]
		dstPath := args[1]

		src, err := clogFs.Open(core.Clean(srcPath))
		if err != nil {
			fmt.Fprintf(os.Stderr, "%s\n", err)
			os.Exit(126)
		}
		defer src.Close()

		dst, err := os.Create(dstPath)
		if err != nil {
			fmt.Fprintf(os.Stderr, "%s\n", err)
			os.Exit(126)
		}
		defer dst.Close()

		nBytes, err := io.Copy(dst, src)
		if err != nil {
			fmt.Fprintf(os.Stderr, "%s (%d bytes copied)\n", err, nBytes)
			os.Exit(126)
		}
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL