File tree Expand file tree Collapse file tree 5 files changed +13
-13
lines changed
Expand file tree Collapse file tree 5 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -59,9 +59,9 @@ func main() {
5959
6060 var cmd command.Cmd
6161 if args .ExampleName != "" {
62- cmd = NewRunOnceCommand (NewRunOnceArgs (args .ExampleName , mapping ))
62+ cmd = command . NewRunOnceCommand (command . NewRunOnceArgs (args .ExampleName , mapping ))
6363 } else {
64- cmd = NewRunLoopCommand (NewRunLoopArgs (args , mapping ))
64+ cmd = command . NewRunLoopCommand (command . NewRunLoopArgs (args . OneTime , mapping ))
6565 }
6666
6767 if err := cmd .Run (); err != nil {
Original file line number Diff line number Diff line change 1- package main
1+ package command
22
33import (
44 "fmt"
Original file line number Diff line number Diff line change 1- package main
1+ package command
22
33import (
44 "fmt"
Original file line number Diff line number Diff line change 1- package main
1+ package command
22
33import (
44 "bufio"
@@ -18,15 +18,15 @@ type (
1818
1919 // RunLoopArgs -- RunLoopCommand の引数データを表します.
2020 RunLoopArgs struct {
21- MainArgs * Args // 引数
22- Mapping mappings.ExampleMapping // マッピング情報
21+ OneTime bool // 一回実行で完了するかどうか
22+ Mapping mappings.ExampleMapping // マッピング情報
2323 }
2424)
2525
2626// NewRunLoopArgs -- 新しい RunLoopArgs を生成して返します.
27- func NewRunLoopArgs (mainArgs * Args , mapping mappings.ExampleMapping ) * RunLoopArgs {
27+ func NewRunLoopArgs (oneTime bool , mapping mappings.ExampleMapping ) * RunLoopArgs {
2828 a := new (RunLoopArgs )
29- a .MainArgs = mainArgs
29+ a .OneTime = oneTime
3030 a .Mapping = mapping
3131 return a
3232}
@@ -41,8 +41,8 @@ func NewRunLoopCommand(args *RunLoopArgs) *RunLoopCommand {
4141// Run -- 実行します.
4242func (c * RunLoopCommand ) Run () error {
4343 var (
44- mainArgs = c .Args .MainArgs
45- mapping = c .Args .Mapping
44+ oneTime = c .Args .OneTime
45+ mapping = c .Args .Mapping
4646 )
4747
4848 fmt .Print ("ENTER EXAMPLE NAME: " )
@@ -104,7 +104,7 @@ func (c *RunLoopCommand) Run() error {
104104 }
105105 }
106106
107- if mainArgs . OneTime {
107+ if oneTime {
108108 break
109109 }
110110
Original file line number Diff line number Diff line change 1- package main
1+ package command
22
33import (
44 "github.com/devlights/try-golang/pkg/mappings"
You can’t perform that action at this time.
0 commit comments