Skip to content

Commit 60f99ad

Browse files
committed
Add xbps-uchroot completer
1 parent a07acb4 commit 60f99ad

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var rootCmd = &cobra.Command{
9+
Use: "xbps-uchroot [OPTIONS] [--] <dir> <cmd> [<cmdargs>]",
10+
Short: "XBPS utility to chroot and bind mount with Linux namespaces",
11+
Run: func(cmd *cobra.Command, args []string) {},
12+
}
13+
14+
func Execute() error {
15+
return rootCmd.Execute()
16+
}
17+
func init() {
18+
carapace.Gen(rootCmd).Standalone()
19+
20+
rootCmd.Flags().StringP("bind-ro", "B", "", "Bind mounts <src> into <dir>/<dest> (read-only)")
21+
rootCmd.Flags().StringP("bind-rw", "b", "", "Bind mounts <src> into <dir>/<dest> (read-write)")
22+
rootCmd.Flags().BoolP("overlayfs", "O", false, "Creates a tempdir and mounts <dir> read-only via overlayfs")
23+
rootCmd.Flags().BoolP("tmpfs", "t", false, "Creates a tempdir and mounts <dir> on tmpfs (for use with -O)")
24+
rootCmd.Flags().StringP("options", "o", "", "Options to be passed to the tmpfs mount (for use with -t)")
25+
rootCmd.Flags().BoolP("help", "h", false, "Show usage")
26+
rootCmd.Flags().BoolP("verbose", "v", false, "Show XBPS version")
27+
28+
carapace.Gen(rootCmd).PositionalCompletion(carapace.ActionDirectories())
29+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package main
2+
3+
import "github.com/carapace-sh/carapace-bin/completers/common/xbps-uchroot_completer/cmd"
4+
5+
func main() {
6+
cmd.Execute()
7+
}

0 commit comments

Comments
 (0)