ls

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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cli.Command{
	Name:  "ls",
	Usage: "List directory contents",
	Flags: []cli.Flag{
		&cli.BoolFlag{Name: "long", Aliases: []string{"l"}, Usage: "Long listing format"},
		&cli.BoolFlag{Name: "all", Aliases: []string{"a"}, Usage: "Include hidden files"},
	},
	Action: func(ctx context.Context, cmd *cli.Command) error {
		long := cmd.Bool("long")
		all := cmd.Bool("all")

		files := cmd.Args().Slice()
		if len(files) == 0 {
			files = []string{"."}
		}

		for _, file := range files {
			if long {
				if err := listLong(file, all); err != nil {
					fmt.Fprintln(os.Stderr, err)
				}
			} else {
				if err := listShort(file, all); err != nil {
					fmt.Fprintln(os.Stderr, err)
				}
			}
		}
		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