Skip to content

Commit

Permalink
rename project
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderMac committed Nov 12, 2024
1 parent 662a0ee commit 3f15615
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 22 deletions.
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<div align="center">
<h1>Go-Fit</h1>
<h1>Go-Fix-Ext</h1>
<p>Fix binary file extensions using magic numbers header signature</p>
<p>
<a href="https://github.com/alexandermac/gofit/actions/workflows/ci.yml?query=branch%3Amaster"><img src="https://github.com/alexandermac/gofit/actions/workflows/ci.yml/badge.svg" alt="Build Status"></a>
<a href="LICENSE"><img src="https://img.shields.io/github/license/alexandermac/gofit.svg" alt="License"></a>
<a href="https://github.com/alexandermac/gofixt/actions/workflows/ci.yml?query=branch%3Amaster"><img src="https://github.com/alexandermac/gofixt/actions/workflows/ci.yml/badge.svg" alt="Build Status"></a>
<a href="LICENSE"><img src="https://img.shields.io/github/license/alexandermac/gofixt.svg" alt="License"></a>
</p>
</div>


```sh
# Run the app in scan mode
gofit --dir=./tmp scan
gofixt --dir=./tmp scan
# Output
| File | Mime | Orig ext. | Real ext. | Notes |
| ---- | ---- | --------- | --------- | ----- |
Expand All @@ -24,7 +23,7 @@ gofit --dir=./tmp scan
7 file(s) processed and 0 file(s) fixed in 211.589µs

# Run the app in fix mode
gofit --dir=./tmp fix
gofixt --dir=./tmp fix
| File | Mime | Orig ext. | Real ext. | Notes |
| ---- | ---- | --------- | --------- | ----- |
| <dir>/png-picture2.png | image/png | .png | .png | |
Expand All @@ -45,14 +44,14 @@ gofit --dir=./tmp fix

# Install
```sh
# Install the gofit binary in your $GOPATH/bin directory
# Install the gofixt binary in your $GOPATH/bin directory
go install github.com/alexandermac/gom/cmd/gom
```

# Usage
## CLI
```
Usage: gofit [flags] command
Usage: gofixt [flags] command
Flags:
--dir Scanning directory (absolute or relative path)
Expand All @@ -65,8 +64,8 @@ Commands:
version Prints app version
Examples:
gofit --dir=~/images scan
gofit --dir=~/files --silent fix
gofixt --dir=~/images scan
gofixt --dir=~/files --silent fix
```

# License
Expand Down
14 changes: 7 additions & 7 deletions cmd/gofit/main.go → cmd/gofixt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import (
"log"
"os"

"github.com/AlexanderMac/gofit"
"github.com/AlexanderMac/gofixt"
)

const VERSION = "0.1.0"

func main() {
log.SetFlags(0)

flags := flag.NewFlagSet("gofit", flag.ExitOnError)
flags := flag.NewFlagSet("gofixt", flag.ExitOnError)
flags.Usage = usage
dir := flags.String("dir", "", "Scanning directory")
silent := flags.Bool("silent", false, "Don't print report")
Expand All @@ -38,12 +38,12 @@ func main() {
os.Exit(0)
case "scan":
validateFlags(*dir)
if err := gofit.Scan(*dir, *silent); err != nil {
if err := gofixt.Scan(*dir, *silent); err != nil {
log.Fatal(err)
}
case "fix":
validateFlags(*dir)
if err := gofit.Fix(*dir, *silent); err != nil {
if err := gofixt.Fix(*dir, *silent); err != nil {
log.Fatal(err)
}
default:
Expand All @@ -53,7 +53,7 @@ func main() {
}

func usage() {
const usagePrefix = `Usage: gofit [flags] command
const usagePrefix = `Usage: gofixt [flags] command
Flags:
--dir Scanning directory (absolute or relative path)
Expand All @@ -66,8 +66,8 @@ Commands:
version Prints app version
Examples:
gofit --dir=~/images scan
gofit --dir=~/files fix
gofixt --dir=~/images scan
gofixt --dir=~/files fix
`

log.Print(usagePrefix)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/AlexanderMac/gofit
module github.com/AlexanderMac/gofixt

go 1.23

Expand Down
4 changes: 2 additions & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ do
platform_parts=(${platform//\// })
goos=${platform_parts[0]}
goarch=${platform_parts[1]}
output_name=build/gofit-v$version.$goos-$goarch
output_name=build/gofixt-v$version.$goos-$goarch
if [ $goos = "windows" ]; then
output_name+='.exe'
fi
env GOOS=$goos GOARCH=$goarch go build -o $output_name cmd/gofit/main.go
env GOOS=$goos GOARCH=$goarch go build -o $output_name cmd/gofixt/main.go
done
2 changes: 1 addition & 1 deletion table-writer.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gofit
package gofixt

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion worker.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gofit
package gofixt

import (
"context"
Expand Down

0 comments on commit 3f15615

Please sign in to comment.