https://github.com/gregoryv/workdir
go package defines WorkDir type for easy file operations
https://github.com/gregoryv/workdir
Last synced: 11 months ago
JSON representation
go package defines WorkDir type for easy file operations
- Host: GitHub
- URL: https://github.com/gregoryv/workdir
- Owner: gregoryv
- Created: 2018-12-29T14:58:57.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-06-10T09:11:07.000Z (about 5 years ago)
- Last Synced: 2025-03-30T05:13:18.812Z (about 1 year ago)
- Language: Go
- Size: 1020 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
[](https://travis-ci.org/gregoryv/workdir)
[](https://codecov.io/gh/gregoryv/workdir)
[workdir](https://godoc.org/github.com/gregoryv/workdir) - Go package defines WorkDir type for easy file operations
Note! This package is the precursor
of [working](https://godoc.org/github.com/gregoryv/working). I was not
quite happy with name workdir, but keeping it open for now.
This package is most useful if you need to do multiple file operations
within one directory. Eg. something like
cd /tmp/dir
mkdir child1 child2
touch child1/A child2/B
# do some stuff
cd
rm -rf /tmp/dir
Simply cast a path to a WorkDir type
wd := workdir.New("/tmp/dir")
wd.MkdirAll("child1", "child2")
wd.TouchAll("child1/A", "child2/B")
// do stuff
wd.RemoveAll()
There is also some code here for merging git output with plain ls result.