fops
is a simple command-line application which is built using Cobra.
- Based on Cobra.
- Use gabriel-vasile/mimetype to detect the file type.
- All the algorithms supported by
checksum
and theirs implementations are stored in a map. Therefore, it's easy to extend the flags. - Use build time flags to set the application version.
This project is based on Cobra.
cmd/
root.go
<commands>.go
pkg/
<utils>
tests/
<input files for test>
main.go
The main.go
initilizes the Cobra. And each command has its own file in cmd/
. For example, The version
command is written in cmd/version.go
.
- linecount: Implementation of
wc -l [file]
. - checksum: Print the checksum of the file. (--md5, --sha1, --sha256).
go run main.go
go test ./...
chmod +x build.sh
./build.sh $version