cat

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 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:   "Cat",
	Short: "copy an internal file to stdout",
	Long:  `returns error status 1 if file not found.`,

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

		src, err := clogFs.Open(core.Clean(srcPath))
		if err != nil {
			slog.Error(fmt.Sprintf("cannot open embedded file %s", srcPath), "err", err)
			os.Exit(126)
		}
		defer src.Close()

		dst := os.Stdout

		nBytes, err := io.Copy(dst, src)
		if err != nil {
			slog.Error(fmt.Sprintf("cannot read embedded file %s (%d bytes copied)", srcPath, nBytes), "err", err)
			os.Exit(126)
		}
	},
}

Command define the cobra settings for this command

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