Skip to content

Commit 51e8c55

Browse files
committed
change structure
1 parent 5868629 commit 51e8c55

File tree

11 files changed

+26
-19
lines changed

11 files changed

+26
-19
lines changed

kadai1/tanaka0325/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
```zsh
2626
# build
27-
$ go build -o ./imgconv
27+
$ go build -o imgconv ./cmd/imgconv
2828

2929
# display help
3030
$ ./imgconv -h

kadai1/tanaka0325/imgconv.go

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package main
2+
3+
import (
4+
"github.com/gopherdojo/dojo8/kadai1/tanaka0325/imgconv"
5+
)
6+
7+
func main() {
8+
imgconv.Run()
9+
}

kadai1/tanaka0325/converter/conv_image.go renamed to kadai1/tanaka0325/imgconv/conv_image.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package converter
1+
package imgconv
22

33
import (
44
"fmt"

kadai1/tanaka0325/converter/exts.go renamed to kadai1/tanaka0325/imgconv/exts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package converter
1+
package imgconv
22

33
import "errors"
44

kadai1/tanaka0325/go.mod renamed to kadai1/tanaka0325/imgconv/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/gopherdojo/dojo8/kadai1/tanaka0325
1+
module github.com/gopherdojo/dojo8/kadai1/tanaka0325/imgconv
22

33
go 1.14
44

File renamed without changes.

kadai1/tanaka0325/converter/convert.go renamed to kadai1/tanaka0325/imgconv/imgconv.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package converter
1+
package imgconv
22

33
import (
44
"flag"
@@ -9,18 +9,23 @@ import (
99
"strings"
1010
)
1111

12-
// flags
1312
var (
13+
// flags
14+
f = flag.String("f", "jpg", "file extention before convert")
15+
t = flag.String("t", "png", "file extention after convert")
16+
dryRun = flag.Bool("n", false, "dry run")
17+
18+
// allow extensions
1419
allowedExts = exts{"png", "jpg", "jpeg", "gif", "bmp", "tiff", "tif"}
15-
f = flag.String("f", "jpg", "file extention before convert")
16-
t = flag.String("t", "png", "file extention after convert")
17-
dryRun = flag.Bool("n", false, "dry run")
1820
)
1921

20-
// Convert is to convert image file format
21-
func Convert() {
22-
// check options ext
22+
func init() {
2323
flag.Parse()
24+
}
25+
26+
// Run is to convert image file format
27+
func Run() {
28+
// check options ext
2429
to := strings.ToLower(*t)
2530
from := strings.ToLower(*f)
2631
targetExts := []string{to, from}

0 commit comments

Comments
 (0)