Skip to content

Commit 8136965

Browse files
committed
refactor
1 parent 40f7d6b commit 8136965

File tree

7 files changed

+13
-33
lines changed

7 files changed

+13
-33
lines changed

src/backup/command.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ func GetCommand() cmdline.Command {
1919
}
2020
return ""
2121
},
22-
Run: func(distroName string, args []string) {
23-
execute(distroName, args)
24-
},
22+
Run: execute,
2523
}
2624
}
2725

src/clean/command.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ func GetCommand() cmdline.Command {
1919
}
2020
return ""
2121
},
22-
Run: func(distroName string, args []string) {
23-
execute(distroName, args)
24-
},
22+
Run: execute,
2523
}
2624
}
2725

src/config/command.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ func GetCommand() cmdline.Command {
2323
}
2424
return ""
2525
},
26-
Run: func(distroName string, args []string) {
27-
execute(distroName, args)
28-
},
26+
Run: execute,
2927
}
3028
}
3129

src/get/command.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ func GetCommand() cmdline.Command {
2222
}
2323
return ""
2424
},
25-
Run: func(distroName string, args []string) {
26-
execute(distroName, args)
27-
},
25+
Run: execute,
2826
}
2927
}
3028

src/install/command.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ func GetCommandWithNoArgs() cmdline.Command {
2222
}
2323
return ""
2424
},
25-
Run: func(distroName string, args []string) {
26-
execute(distroName, args)
27-
},
25+
Run: execute,
2826
}
2927
}
3028

@@ -38,9 +36,7 @@ func GetCommand() cmdline.Command {
3836
}
3937
return ""
4038
},
41-
Run: func(distroName string, args []string) {
42-
execute(distroName, args)
43-
},
39+
Run: execute,
4440
}
4541
}
4642

src/isregd/command.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ import (
1010
func GetCommand() cmdline.Command {
1111
return cmdline.Command{
1212
Names: []string{"isregd"},
13-
Run: func(distroName string, args []string) {
14-
Execute(distroName)
15-
},
13+
Run: execute,
1614
}
1715
}
1816

19-
// Execute is default isregd entrypoint. Exits with registerd status
20-
func Execute(name string) {
17+
// execute is default isregd entrypoint. Exits with registerd status
18+
func execute(name string, args []string) {
2119
if wsllib.WslIsDistributionRegistered(name) {
2220
os.Exit(0)
2321
}

src/run/command.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ func GetCommandWithNoArgs() cmdline.Command {
2222
return ""
2323
}
2424
},
25-
Run: func(distroName string, args []string) {
26-
executeNoArgs(distroName)
27-
},
25+
Run: executeNoArgs,
2826
}
2927
}
3028

@@ -39,9 +37,7 @@ func GetCommand() cmdline.Command {
3937
return ""
4038
}
4139
},
42-
Run: func(distroName string, args []string) {
43-
execute(distroName, args)
44-
},
40+
Run: execute,
4541
}
4642
}
4743

@@ -56,9 +52,7 @@ func GetCommandP() cmdline.Command {
5652
return ""
5753
}
5854
},
59-
Run: func(distroName string, args []string) {
60-
executeP(distroName, args)
61-
},
55+
Run: executeP,
6256
}
6357
}
6458

@@ -106,7 +100,7 @@ func executeP(name string, args []string) {
106100
}
107101

108102
// executeNoArgs runs distro, but use terminal settings
109-
func executeNoArgs(name string) {
103+
func executeNoArgs(name string, args []string) {
110104
efPath, _ := os.Executable()
111105
profile, _ := wslreg.GetProfileFromName(name)
112106

0 commit comments

Comments
 (0)