cat

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cli.Command{
	Name:  "cat",
	Usage: "Display file contents",
	Action: func(ctx context.Context, cmd *cli.Command) error {
		files := cmd.Args().Slice()
		if len(files) == 0 {
			_, err := io.Copy(os.Stdout, os.Stdin)
			return err
		}

		for _, file := range files {
			f, err := os.Open(file)
			if err != nil {
				return fmt.Errorf("cat: %s: %v", file, err)
			}
			if _, err := io.Copy(os.Stdout, f); err != nil {
				f.Close()
				return err
			}
			f.Close()
		}
		return nil
	},
}

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