Skip to content

Commit 58dd287

Browse files
authored
Merge pull request #3152 from fgietzen/master
Add completer for xbps-*
2 parents 115d17d + e0afb86 commit 58dd287

File tree

48 files changed

+1069
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1069
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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-alternatives [OPTIONS] [MODE]",
11+
Short: "XBPS utility to handle alternatives",
12+
Long: "https://man.voidlinux.org/xbps-alternatives",
13+
Run: func(cmd *cobra.Command, args []string) {},
14+
}
15+
16+
func Execute() error {
17+
return rootCmd.Execute()
18+
}
19+
func init() {
20+
carapace.Gen(rootCmd).Standalone()
21+
22+
rootCmd.Flags().BoolP("R", "R", false, "Enable repository mode. This mode explicitly looks for packages in repositories")
23+
rootCmd.Flags().StringP("config", "C", "", "Path to confdir (xbps.d)")
24+
rootCmd.Flags().BoolP("debug", "d", false, "Debug mode shown to stderr")
25+
rootCmd.Flags().StringP("group", "g", "", "Group of alternatives to match")
26+
rootCmd.Flags().BoolP("help", "h", false, "Show usage")
27+
rootCmd.Flags().BoolP("ignore-conf-repos", "i", false, "Ignore repositories defined in xbps.d")
28+
rootCmd.Flags().StringP("list", "l", "", "List all alternatives or from PKG")
29+
rootCmd.Flags().StringArray("repository", nil, "Enable repository mode and add repository to the top of the list. This option can be specified multiple times")
30+
rootCmd.Flags().StringP("rootdir", "r", "", "Full path to rootdir")
31+
rootCmd.Flags().StringP("set", "s", "", "Set alternatives for PKG")
32+
rootCmd.Flags().BoolP("verbose", "v", false, "Verbose messages")
33+
rootCmd.Flags().BoolP("version", "V", false, "Show XBPS version")
34+
35+
rootCmd.MarkFlagsMutuallyExclusive("list", "set")
36+
37+
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
38+
"config": carapace.ActionDirectories(),
39+
"list": xbps.ActionPackageSearch(),
40+
"rootdir": carapace.ActionDirectories(),
41+
"set": xbps.ActionPackageSearch(),
42+
})
43+
}
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/linux/xbps-alternatives_completer/cmd"
4+
5+
func main() {
6+
cmd.Execute()
7+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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-checkvers [OPTIONS] [FILES...]",
10+
Short: "XBPS utility to check for outdated packages",
11+
Long: "https://man.voidlinux.org/xbps-checkvers",
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().BoolP("debug", "d", false, "Debug mode shown to stderr")
23+
rootCmd.Flags().StringP("distdir", "D", "", "Set (or override) the path to void-packages (defaults to ~/void-packages)")
24+
rootCmd.Flags().BoolP("help", "h", false, "Show usage")
25+
rootCmd.Flags().BoolP("ignore-conf-repos", "i", false, "Ignore repositories defined in xbps.d")
26+
rootCmd.Flags().BoolP("installed", "I", false, "Check for outdated packages in rootdir, rather than in the XBPS repositories")
27+
rootCmd.Flags().BoolP("manual", "m", false, "Only process listed files")
28+
rootCmd.Flags().BoolP("removed", "e", false, "List packages present in repos, but not in distdir")
29+
rootCmd.Flags().StringArrayP("repository", "R", nil, "Append repository to the head of repository list")
30+
rootCmd.Flags().StringP("rootdir", "r", "", "Full path to rootdir")
31+
rootCmd.Flags().BoolP("show-all", "s", false, "List all packages, in the format 'pkgname repover srcver'")
32+
rootCmd.Flags().Bool("staging", false, "Enable use of staged packages")
33+
34+
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
35+
"config": carapace.ActionDirectories(),
36+
"distdir": carapace.ActionDirectories(),
37+
"rootdir": carapace.ActionDirectories(),
38+
})
39+
carapace.Gen(rootCmd).PositionalAnyCompletion(carapace.ActionFiles())
40+
}
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/linux/xbps-checkvers_completer/cmd"
4+
5+
func main() {
6+
cmd.Execute()
7+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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-create [OPTIONS] -A <arch> -n <pkgver> -s \"<desc>\" destdir",
10+
Short: "XBPS utility to create binary packages",
11+
Long: "https://man.voidlinux.org/xbps-create",
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().String("alternatives", "", "List of available alternatives this pkg provides")
22+
rootCmd.Flags().StringP("architecture", "A", "", "Package architecture (e.g: noarch, i686, etc)")
23+
rootCmd.Flags().String("build-options", "", "A string with the used build options")
24+
rootCmd.Flags().StringP("built-with", "B", "", "Package builder string (e.g: xbps-src-30)")
25+
rootCmd.Flags().StringP("changelog", "c", "", "Changelog URL")
26+
rootCmd.Flags().String("compression", "zstd", "Compression format: none, gzip, bzip2, lz4, xz, zstd (default)")
27+
rootCmd.Flags().StringP("config-files", "F", "", "Configuration files (blank separated list)")
28+
rootCmd.Flags().StringP("conflicts", "C", "", "Conflicts (blank separated list, e.g: 'foo>=2.0 blah<=2.0')")
29+
rootCmd.Flags().StringP("dependencies", "D", "", "Dependencies (blank separated list, e.g: 'foo>=1.0_1 blah<2.1')")
30+
rootCmd.Flags().StringP("desc", "s", "", "Short description (max 80 characters)")
31+
rootCmd.Flags().BoolP("help", "h", false, "Show usage")
32+
rootCmd.Flags().StringP("homepage", "H", "", "Homepage")
33+
rootCmd.Flags().StringP("license", "l", "", "License")
34+
rootCmd.Flags().StringP("long-desc", "S", "", "Long description (80 cols per line)")
35+
rootCmd.Flags().StringP("maintainer", "m", "", "Maintainer")
36+
rootCmd.Flags().StringP("mutable-files", "M", "", "Mutable files list (blank separated list)")
37+
rootCmd.Flags().StringP("pkgver", "n", "", "Package name/version tuple (e.g: foo-1.0_1)")
38+
rootCmd.Flags().BoolP("preserve", "p", false, "Enable package preserve boolean")
39+
rootCmd.Flags().StringP("provides", "P", "", "Provides (blank separated list, e.g: 'foo-9999 blah-1.0')")
40+
rootCmd.Flags().BoolP("quiet", "q", false, "Work silently")
41+
rootCmd.Flags().StringP("replaces", "R", "", "Replaces (blank separated list, e.g: 'foo>=1.0 blah<2.0')")
42+
rootCmd.Flags().StringP("reverts", "r", "", "Reverts (blank separated list, e.g: '1.0_1 2.0_3')")
43+
rootCmd.Flags().String("shlib-provides", "", "List of provided shared libraries")
44+
rootCmd.Flags().String("shlib-requires", "", "List of required shared libraries")
45+
rootCmd.Flags().StringP("tags", "t", "", "A list of tags/categories (blank separated list)")
46+
rootCmd.Flags().BoolP("version", "V", false, "Show XBPS version")
47+
48+
rootCmd.MarkFlagRequired("architecture")
49+
rootCmd.MarkFlagRequired("pkgver")
50+
rootCmd.MarkFlagRequired("desc")
51+
52+
carapace.Gen(rootCmd).PositionalCompletion(carapace.ActionDirectories())
53+
}
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/linux/xbps-create_completer/cmd"
4+
5+
func main() {
6+
cmd.Execute()
7+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
Long: "https://man.voidlinux.org/xbps-dgraph",
13+
Run: func(cmd *cobra.Command, args []string) {},
14+
}
15+
16+
func Execute() error {
17+
return rootCmd.Execute()
18+
}
19+
func init() {
20+
carapace.Gen(rootCmd).Standalone()
21+
22+
rootCmd.Flags().StringP("config", "C", "", "Path to confdir (xbps.d)")
23+
rootCmd.Flags().BoolP("debug", "d", false, "Debug mode shown to stderr")
24+
rootCmd.Flags().BoolP("fulldeptree", "f", false, "Generate a dependency graph")
25+
rootCmd.Flags().BoolP("gen-config", "g", false, "Generate a configuration file")
26+
rootCmd.Flags().StringP("graph-config", "c", "", "Path to the graph configuration file")
27+
rootCmd.Flags().BoolP("help", "h", false, "Show usage")
28+
rootCmd.Flags().BoolP("memory-sync", "M", false, "Remote repository data is fetched and stored in memory, ignoring on-disk repodata archives.")
29+
rootCmd.Flags().BoolP("metadata", "m", false, "Generate a metadata graph (default mode)")
30+
rootCmd.Flags().BoolP("repository", "R", false, "Enable repository mode. This mode explicitly looks for packages in repositories.")
31+
rootCmd.Flags().StringP("rootdir", "r", "", "Full path to rootdir")
32+
33+
rootCmd.MarkFlagsMutuallyExclusive("gen-config", "fulldeptree", "metadata")
34+
35+
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
36+
"config": carapace.ActionDirectories(),
37+
"graph-config": carapace.ActionFiles(),
38+
"rootdir": carapace.ActionDirectories(),
39+
})
40+
41+
carapace.Gen(rootCmd).PositionalCompletion(xbps.ActionPackages().FilterArgs())
42+
}
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/linux/xbps-reconfigure_completer/cmd"
4+
5+
func main() {
6+
cmd.Execute()
7+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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-digest [options] [file] [file+N]",
10+
Short: "XBPS utility to generate message digests",
11+
Long: "https://man.voidlinux.org/xbps-digest",
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().BoolP("help", "h", false, "Show usage")
22+
rootCmd.Flags().StringP("mode", "m", "sha256", "Selects the digest mode, sha256 (default)")
23+
rootCmd.Flags().BoolP("version", "V", false, "Show XBPS version")
24+
25+
carapace.Gen(rootCmd).PositionalAnyCompletion(carapace.ActionFiles())
26+
}
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/linux/xbps-digest_completer/cmd"
4+
5+
func main() {
6+
cmd.Execute()
7+
}

0 commit comments

Comments
 (0)