-
-
Notifications
You must be signed in to change notification settings - Fork 43
/
pkgid.go
28 lines (23 loc) · 876 Bytes
/
pkgid.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/completers/cargo_completer/cmd/action"
"github.com/spf13/cobra"
)
var pkgidCmd = &cobra.Command{
Use: "pkgid",
Short: "Print a fully qualified package specification",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(pkgidCmd).Standalone()
pkgidCmd.Flags().BoolP("help", "h", false, "Print help")
pkgidCmd.Flags().String("manifest-path", "", "Path to Cargo.toml")
pkgidCmd.Flags().StringP("package", "p", "", "Argument to get the package ID specifier for")
pkgidCmd.Flags().BoolP("quiet", "q", false, "Do not print cargo log messages")
rootCmd.AddCommand(pkgidCmd)
carapace.Gen(pkgidCmd).FlagCompletion(carapace.ActionMap{
"manifest-path": carapace.ActionFiles(),
"package": action.ActionDependencies(pkgidCmd, true),
})
}