Skip to content

Commit 098d66a

Browse files
authored
Merge pull request #391 from rsteube/cfdisk-blockdevices
cfdisk: complete blockdevices
2 parents 44ee660 + 6394d12 commit 098d66a

File tree

1 file changed

+10
-1
lines changed
  • completers/cfdisk_completer/cmd

1 file changed

+10
-1
lines changed

completers/cfdisk_completer/cmd/root.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cmd
22

33
import (
44
"github.com/rsteube/carapace"
5+
"github.com/rsteube/carapace-bin/pkg/actions/fs"
56
"github.com/spf13/cobra"
67
)
78

@@ -32,6 +33,14 @@ func init() {
3233
})
3334

3435
carapace.Gen(rootCmd).PositionalCompletion(
35-
carapace.ActionFiles(),
36+
ActionBlockDevicesAndFiles(),
3637
)
3738
}
39+
40+
func ActionBlockDevicesAndFiles() carapace.Action {
41+
return carapace.ActionCallback(func(c carapace.Context) carapace.Action {
42+
blockDevices := fs.ActionBlockDevices().Invoke(c)
43+
files := carapace.ActionFiles().Invoke(c)
44+
return blockDevices.Merge(files).ToA()
45+
})
46+
}

0 commit comments

Comments
 (0)