Skip to content

Commit e03ad67

Browse files
committed
Add xbps-dgraph completer
1 parent 11e8c4a commit e03ad67

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/xbps"
6+
"github.com/spf13/cobra"
7+
)
8+
9+
var rootCmd = &cobra.Command{
10+
Use: "xbps-dgraph [OPTIONS] [MODE] <pkgname>",
11+
Short: "XBPS utility to generate package dot graphs",
12+
Run: func(cmd *cobra.Command, args []string) {},
13+
}
14+
15+
func Execute() error {
16+
return rootCmd.Execute()
17+
}
18+
func init() {
19+
carapace.Gen(rootCmd).Standalone()
20+
21+
rootCmd.Flags().StringP("config", "C", "", "Path to confdir (xbps.d)")
22+
rootCmd.Flags().StringP("graph-config", "c", "", "Path to the graph configuration file")
23+
rootCmd.Flags().BoolP("debug", "d", false, "Debug mode shown to stderr")
24+
rootCmd.Flags().BoolP("help", "h", false, "Show usage")
25+
rootCmd.Flags().BoolP("memory-sync", "M", false, "Remote repository data is fetched and stored in memory, ignoring on-disk repodata archives.")
26+
rootCmd.Flags().StringP("rootdir", "r", "", "Full path to rootdir")
27+
rootCmd.Flags().BoolP("repository", "R", false, "Enable repository mode. This mode explicitly looks for packages in repositories.")
28+
rootCmd.Flags().BoolP("gen-config", "g", false, "Generate a configuration file")
29+
rootCmd.Flags().BoolP("fulldeptree", "f", false, "Generate a dependency graph")
30+
rootCmd.Flags().BoolP("metadata", "m", false, "Generate a metadata graph (default mode)")
31+
32+
rootCmd.MarkFlagsMutuallyExclusive("gen-config", "fulldeptree", "metadata")
33+
34+
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
35+
"config": carapace.ActionDirectories(),
36+
"graph-config": carapace.ActionFiles(),
37+
"rootdir": carapace.ActionDirectories(),
38+
})
39+
40+
carapace.Gen(rootCmd).PositionalCompletion(xbps.ActionPackages().FilterArgs())
41+
}
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-reconfigure_completer/cmd"
4+
5+
func main() {
6+
cmd.Execute()
7+
}

0 commit comments

Comments
 (0)