fscmd

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: MIT Imports: 15 Imported by: 2

README

fscmd

doc

Create command line tools with various subcommands which imitate unix commands but for io/fs.FS file system structures.

Subcommands:

  • cat: Print file contents
  • file: Determine files types
  • hashsum: Print hashsums
  • ls: List directory contents
  • stat: Display file status
  • tree: List contents of directories in a tree-like format

Usage

func main() {
	fsys := &fstest.MapFS{
		"foo":        &fstest.MapFile{Data: []byte("foo")},
		"folder/bar": &fstest.MapFile{Data: []byte("bar")},
	}
	fsCmd := fscmd.FSCommand(fsys, nil)
	fsCmd.Use = "fs"
	fsCmd.Short = "example for fscmd usage"
	err := fsCmd.Execute()
	if err != nil {
		log.Fatal(err)
	}
}
go build . && ./fs cat foo

Documentation

Overview

Package fscmd implements the fs command line tool that has various subcommands which imitate unix commands but for file system structures.

cat      Print files
file     Determine files types
hashsum  Print hashsums
ls       List directory contents
stat     Display file status
strings  Find the printable strings in an object, or other binary, file
tree     List contents of directories in a tree-like format

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CatCmd

func CatCmd(parse func(*cobra.Command, []string) (fs.FS, []string, error)) func(_ *cobra.Command, args []string)

func FSCommand

func FSCommand(parseFunc func(_ *cobra.Command, args []string) (fs.FS, []string, error)) *cobra.Command

func FileCmd

func FileCmd(parse func(*cobra.Command, []string) (fs.FS, []string, error)) func(_ *cobra.Command, args []string)

func HashsumCmd

func HashsumCmd(parse func(*cobra.Command, []string) (fs.FS, []string, error)) func(_ *cobra.Command, args []string)

func LsCmd

func LsCmd(parse func(*cobra.Command, []string) (fs.FS, []string, error)) func(_ *cobra.Command, args []string)

func StatCmd

func StatCmd(parse func(*cobra.Command, []string) (fs.FS, []string, error)) func(_ *cobra.Command, args []string)

func TreeCmd

func TreeCmd(parse func(*cobra.Command, []string) (fs.FS, []string, error)) func(_ *cobra.Command, args []string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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