File tree Expand file tree Collapse file tree 3 files changed +36
-13
lines changed Expand file tree Collapse file tree 3 files changed +36
-13
lines changed Original file line number Diff line number Diff line change 7
7
"flag"
8
8
"fmt"
9
9
"io/fs"
10
- "slices"
11
10
"strings"
12
11
13
12
"github.com/djdv/go-filesystem-utils/internal/command"
@@ -255,18 +254,6 @@ func makeMountSubcommands() []command.Command {
255
254
return hosts
256
255
}
257
256
258
- func sortCommands (commands []command.Command ) {
259
- slices .SortFunc (
260
- commands ,
261
- func (a , b command.Command ) int {
262
- return strings .Compare (
263
- a .Name (),
264
- b .Name (),
265
- )
266
- },
267
- )
268
- }
269
-
270
257
func makeMountSubcommand (host filesystem.Host , guestCommands []command.Command ) command.Command {
271
258
var (
272
259
formalName = string (host )
Original file line number Diff line number Diff line change
1
+ //go:build !go1.21
2
+
3
+ package commands
4
+
5
+ import (
6
+ "github.com/djdv/go-filesystem-utils/internal/command"
7
+ "golang.org/x/exp/slices"
8
+ )
9
+
10
+ func sortCommands (commands []command.Command ) {
11
+ slices .SortFunc (commands , func (a , b command.Command ) bool {
12
+ return a .Name () < b .Name ()
13
+ })
14
+ }
Original file line number Diff line number Diff line change
1
+ //go:build go1.21
2
+
3
+ package commands
4
+
5
+ import (
6
+ "slices"
7
+ "strings"
8
+
9
+ "github.com/djdv/go-filesystem-utils/internal/command"
10
+ )
11
+
12
+ func sortCommands (commands []command.Command ) {
13
+ slices .SortFunc (
14
+ commands ,
15
+ func (a , b command.Command ) int {
16
+ return strings .Compare (
17
+ a .Name (),
18
+ b .Name (),
19
+ )
20
+ },
21
+ )
22
+ }
You can’t perform that action at this time.
0 commit comments