rjeczalik / fs

Interface, mocks and codegen for the os package.
MIT License
5 stars 0 forks source link

fs Build Status Build Status Build status Coverage Status

Interface and mocks for the os package. Plus utility and codegen commands.

cmd/gotree GoDoc

Command gotree is Go implementation of the Unix tree command.

Installation

~ $ go get -u github.com/rjeczalik/fs/cmd/gotree

Documentation

godoc.org/github.com/rjeczalik/fs/cmd/gotree

Usage

~/src $ gotree github.com/rjeczalik/fs
github.com/rjeczalik/fs/.
├── fs.go
├── fsutil
│   ├── fsutil.go
│   ├── fsutil_test.go
│   ├── tee.go
│   └── tee_test.go
└── memfs
    ├── memfs.go
    ├── memfs_test.go
    ├── tree.go
    ├── tree_test.go
    ├── util.go
    └── util_test.go

2 directories, 11 files

NOTE fs.Filesystem does not support symlinks yet (#1), that's why gotree will print any symlink as regular file or directory. Moreover it won't follow nor resolve any of them.

~/src $ gotree -go=80 github.com/rjeczalik/fs
memfs.Must(memfs.UnmarshalTab([]byte(".\n\tfs.go\n\tfsutil\n\t\tfsutil.go" +
    "\n\t\tfsutil_test.go\n\t\ttee.go\n\t\ttee_test.go\n\tmemfs\n\t\tmem" +
    "fs.go\n\t\tmemfs_test.go\n\t\ttree.go\n\t\ttree_test.go\n\t\tutil.g" +
    "o\n\t\tutil_test.go\n")))
~/src $ gotree -var=fspkg github.com/rjeczalik/fs
var fspkg = memfs.Must(memfs.UnmarshalTab([]byte(".\n\tfs.go\n\tfsutil\n\t" +
    "\tfsutil.go\n\t\tfsutil_test.go\n\t\ttee.go\n\t\ttee_test.go\n\tmem" +
    "fs\n\t\tmemfs.go\n\t\tmemfs_test.go\n\t\ttree.go\n\t\ttree_test.go\n" +
    "\t\tutil.go\n\t\tutil_test.go\n")))

cmd/mktree GoDoc

Command mktree creates a file tree out of tree output read from standard input.

Installation

~ $ go get -u github.com/rjeczalik/fs/cmd/mktree

Documentation

godoc.org/github.com/rjeczalik/fs/cmd/mktree

Usage

~ $ gotree
.
├── dir
│   └── file.txt
└── file.txt

1 directory, 2 files

~ $ gotree | mktree -o /tmp/mktree

~ $ gotree /tmp/mktree
/tmp/mktree
├── dir
│   └── file.txt
└── file.txt

1 directory, 2 files
~ $ gotree > tree.txt

~ $ mktree -o /tmp/mktree2 tree.txt

~ $ gotree /tmp/mktree2
/tmp/mktree2
├── dir
│   └── file.txt
└── file.txt

1 directory, 2 files

fs GoDoc

Package fs provides an interface for the filesystem-related functions from the os package.

Installation

~ $ go get -u github.com/rjeczalik/fs

Documentation

godoc.org/github.com/rjeczalik/fs

memfs GoDoc

Package memfs provides an implementation for an in-memory filesystem.

Installation

~ $ go get -u github.com/rjeczalik/fs/memfs

Documentation

godoc.org/github.com/rjeczalik/fs/memfs

fsutil GoDoc

Package fsutil is a collection of various filesystem utility functions.

Installation

~ $ go get -u github.com/rjeczalik/fs/fsutil

Documentation

godoc.org/github.com/rjeczalik/fs/fsutil