Skip to content

Commit

Permalink
cargo: updates from 0.82.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Oct 3, 2024
1 parent 9f18adb commit aa570e3
Show file tree
Hide file tree
Showing 36 changed files with 88 additions and 116 deletions.
9 changes: 9 additions & 0 deletions completers/cargo_completer/cmd/action/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ type TargetOpts struct {
Test bool
}

func (t TargetOpts) Default() TargetOpts {
t.Bench = true
t.Bin = true
t.Example = true
t.Lib = true
t.Test = true
return t
}

func (t *TargetOpts) Includes(kinds []string) bool {
var match bool
for _, kind := range kinds {
Expand Down
9 changes: 5 additions & 4 deletions completers/cargo_completer/cmd/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

var addCmd = &cobra.Command{
Use: "add",
Short: "Add dependency to a Cargo.toml manifest file",
Short: "Add dependencies to a Cargo.toml manifest file",
Run: func(cmd *cobra.Command, args []string) {},
GroupID: groupFor("add"),
}
Expand All @@ -25,18 +25,19 @@ func init() {
addCmd.Flags().Bool("build", false, "Add as build dependency")
addCmd.Flags().Bool("default-features", false, "Re-enable the default features")
addCmd.Flags().Bool("dev", false, "Add as development dependency")
addCmd.Flags().Bool("dry-run", false, "Don't actually write the manifest")
addCmd.Flags().BoolP("dry-run", "n", false, "Don't actually write the manifest")
addCmd.Flags().StringSliceP("features", "F", []string{}, "Space or comma separated list of features to activate")
addCmd.Flags().String("git", "", "Git repository location")
addCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
addCmd.Flags().Bool("ignore-rust-version", false, "Ignore `rust-version` specification in packages (unstable)")
addCmd.Flags().Bool("ignore-rust-version", false, "Ignore `rust-version` specification in packages")
addCmd.Flags().String("manifest-path", "", "Path to Cargo.toml")
addCmd.Flags().Bool("no-default-features", false, "Disable the default features")
addCmd.Flags().Bool("no-optional", false, "Mark the dependency as required")
addCmd.Flags().Bool("no-public", false, "Mark the dependency as private (unstable)")
addCmd.Flags().Bool("optional", false, "Mark the dependency as optional")
addCmd.Flags().StringP("package", "p", "", "Package to modify")
addCmd.Flags().String("path", "", "Filesystem path to local crate to add")
addCmd.Flags().BoolP("quiet", "q", false, "Do not print cargo log messages")
addCmd.Flags().Bool("public", false, "Mark the dependency as public (unstable)")
addCmd.Flags().String("registry", "", "Package registry for this dependency")
addCmd.Flags().String("rename", "", "Rename the dependency")
addCmd.Flags().String("rev", "", "Git reference to download the crate from")
Expand Down
8 changes: 3 additions & 5 deletions completers/cargo_completer/cmd/bench.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func init() {
benchCmd.Flags().Bool("all-features", false, "Activate all available features")
benchCmd.Flags().Bool("all-targets", false, "Benchmark all targets")
benchCmd.Flags().StringSlice("bench", []string{}, "Benchmark only the specified bench target")
benchCmd.Flags().Bool("benches", false, "Benchmark all benches")
benchCmd.Flags().Bool("benches", false, "Benchmark all bench targets")
benchCmd.Flags().StringSlice("bin", []string{}, "Benchmark only the specified binary")
benchCmd.Flags().Bool("bins", false, "Benchmark all binaries")
benchCmd.Flags().StringSlice("example", []string{}, "Benchmark only the specified example")
Expand All @@ -29,8 +29,7 @@ func init() {
benchCmd.Flags().StringSliceP("features", "F", []string{}, "Space or comma separated list of features to activate")
benchCmd.Flags().BoolP("help", "h", false, "Print help")
benchCmd.Flags().Bool("ignore-rust-version", false, "Ignore `rust-version` specification in packages")
benchCmd.Flags().StringP("jobs", "j", "", "Number of parallel jobs, defaults to # of CPUs")
benchCmd.Flags().Bool("keep-going", false, "Do not abort the build as soon as there is an error (unstable)")
benchCmd.Flags().StringP("jobs", "j", "", "Number of parallel jobs, defaults to # of CPUs.")
benchCmd.Flags().Bool("lib", false, "Benchmark only this package's library")
benchCmd.Flags().String("manifest-path", "", "Path to Cargo.toml")
benchCmd.Flags().StringSlice("message-format", []string{}, "Error format")
Expand All @@ -39,11 +38,10 @@ func init() {
benchCmd.Flags().Bool("no-run", false, "Compile, but don't run benchmarks")
benchCmd.Flags().StringSliceP("package", "p", []string{}, "Package to run benchmarks for")
benchCmd.Flags().String("profile", "", "Build artifacts with the specified profile")
benchCmd.Flags().BoolP("quiet", "q", false, "Do not print cargo log messages")
benchCmd.Flags().StringSlice("target", []string{}, "Build for the target triple")
benchCmd.Flags().String("target-dir", "", "Directory for all generated artifacts")
benchCmd.Flags().StringSlice("test", []string{}, "Benchmark only the specified test target")
benchCmd.Flags().Bool("tests", false, "Benchmark all tests")
benchCmd.Flags().Bool("tests", false, "Benchmark all test targets")
benchCmd.Flags().String("timings", "", "Timing output formats (unstable) (comma separated): html, json")
benchCmd.Flags().Bool("unit-graph", false, "Output build graph in JSON (unstable)")
benchCmd.Flags().Bool("workspace", false, "Benchmark all packages in the workspace")
Expand Down
14 changes: 6 additions & 8 deletions completers/cargo_completer/cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

var buildCmd = &cobra.Command{
Use: "build",
Aliases: []string{"b"},
Short: "Compile a local package and all of its dependencies",
Run: func(cmd *cobra.Command, args []string) {},
GroupID: groupFor("build"),
Expand All @@ -20,8 +19,9 @@ func init() {
buildCmd.Flags().Bool("all", false, "Alias for --workspace (deprecated)")
buildCmd.Flags().Bool("all-features", false, "Activate all available features")
buildCmd.Flags().Bool("all-targets", false, "Build all targets")
buildCmd.Flags().String("artifact-dir", "", "Copy final artifacts to this directory (unstable)")
buildCmd.Flags().StringSlice("bench", []string{}, "Build only the specified bench target")
buildCmd.Flags().Bool("benches", false, "Build all benches")
buildCmd.Flags().Bool("benches", false, "Build all bench targets")
buildCmd.Flags().StringSlice("bin", []string{}, "Build only the specified binary")
buildCmd.Flags().Bool("bins", false, "Build all binaries")
buildCmd.Flags().Bool("build-plan", false, "Output the build plan in JSON (unstable)")
Expand All @@ -32,36 +32,34 @@ func init() {
buildCmd.Flags().Bool("future-incompat-report", false, "Outputs a future incompatibility report at the end of the build")
buildCmd.Flags().BoolP("help", "h", false, "Print help")
buildCmd.Flags().Bool("ignore-rust-version", false, "Ignore `rust-version` specification in packages")
buildCmd.Flags().StringP("jobs", "j", "", "Number of parallel jobs, defaults to # of CPUs")
buildCmd.Flags().Bool("keep-going", false, "Do not abort the build as soon as there is an error (unstable)")
buildCmd.Flags().StringP("jobs", "j", "", "Number of parallel jobs, defaults to # of CPUs.")
buildCmd.Flags().Bool("keep-going", false, "Do not abort the build as soon as there is an error")
buildCmd.Flags().Bool("lib", false, "Build only this package's library")
buildCmd.Flags().String("manifest-path", "", "Path to Cargo.toml")
buildCmd.Flags().StringSlice("message-format", []string{}, "Error format")
buildCmd.Flags().Bool("no-default-features", false, "Do not activate the `default` feature")
buildCmd.Flags().String("out-dir", "", "Copy final artifacts to this directory (unstable)")
buildCmd.Flags().StringSliceP("package", "p", []string{}, "Package to build (see `cargo help pkgid`)")
buildCmd.Flags().String("profile", "", "Build artifacts with the specified profile")
buildCmd.Flags().BoolP("quiet", "q", false, "Do not print cargo log messages")
buildCmd.Flags().BoolP("release", "r", false, "Build artifacts in release mode, with optimizations")
buildCmd.Flags().StringSlice("target", []string{}, "Build for the target triple")
buildCmd.Flags().String("target-dir", "", "Directory for all generated artifacts")
buildCmd.Flags().StringSlice("test", []string{}, "Build only the specified test target")
buildCmd.Flags().Bool("tests", false, "Build all tests")
buildCmd.Flags().Bool("tests", false, "Build all test targets")
buildCmd.Flags().String("timings", "", "Timing output formats (unstable) (comma separated): html, json")
buildCmd.Flags().Bool("unit-graph", false, "Output build graph in JSON (unstable)")
buildCmd.Flags().Bool("workspace", false, "Build all packages in the workspace")
buildCmd.Flag("timings").NoOptDefVal = " "
rootCmd.AddCommand(buildCmd)

carapace.Gen(buildCmd).FlagCompletion(carapace.ActionMap{
"artifact-dir": carapace.ActionDirectories(),
"bench": action.ActionTargets(buildCmd, action.TargetOpts{Bench: true}),
"bin": action.ActionTargets(buildCmd, action.TargetOpts{Bin: true}),
"example": action.ActionTargets(buildCmd, action.TargetOpts{Example: true}),
"exclude": action.ActionWorkspaceMembers(buildCmd),
"features": action.ActionFeatures(buildCmd).UniqueList(","),
"manifest-path": carapace.ActionFiles(),
"message-format": action.ActionMessageFormats(),
"out-dir": carapace.ActionDirectories(),
"package": action.ActionDependencies(buildCmd, true),
"profile": action.ActionProfiles(buildCmd),
"target-dir": carapace.ActionDirectories(),
Expand Down
10 changes: 4 additions & 6 deletions completers/cargo_completer/cmd/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

var checkCmd = &cobra.Command{
Use: "check",
Aliases: []string{"c"},
Short: "Check a local package and all of its dependencies for errors",
Run: func(cmd *cobra.Command, args []string) {},
GroupID: groupFor("check"),
Expand All @@ -21,7 +20,7 @@ func init() {
checkCmd.Flags().Bool("all-features", false, "Activate all available features")
checkCmd.Flags().Bool("all-targets", false, "Check all targets")
checkCmd.Flags().StringSlice("bench", []string{}, "Check only the specified bench target")
checkCmd.Flags().Bool("benches", false, "Check all benches")
checkCmd.Flags().Bool("benches", false, "Check all bench targets")
checkCmd.Flags().StringSlice("bin", []string{}, "Check only the specified binary")
checkCmd.Flags().Bool("bins", false, "Check all binaries")
checkCmd.Flags().StringSlice("example", []string{}, "Check only the specified example")
Expand All @@ -31,20 +30,19 @@ func init() {
checkCmd.Flags().Bool("future-incompat-report", false, "Outputs a future incompatibility report at the end of the build")
checkCmd.Flags().BoolP("help", "h", false, "Print help")
checkCmd.Flags().Bool("ignore-rust-version", false, "Ignore `rust-version` specification in packages")
checkCmd.Flags().StringP("jobs", "j", "", "Number of parallel jobs, defaults to # of CPUs")
checkCmd.Flags().Bool("keep-going", false, "Do not abort the build as soon as there is an error (unstable)")
checkCmd.Flags().StringP("jobs", "j", "", "Number of parallel jobs, defaults to # of CPUs.")
checkCmd.Flags().Bool("keep-going", false, "Do not abort the build as soon as there is an error")
checkCmd.Flags().Bool("lib", false, "Check only this package's library")
checkCmd.Flags().String("manifest-path", "", "Path to Cargo.toml")
checkCmd.Flags().StringSlice("message-format", []string{}, "Error format")
checkCmd.Flags().Bool("no-default-features", false, "Do not activate the `default` feature")
checkCmd.Flags().StringSliceP("package", "p", []string{}, "Package(s) to check")
checkCmd.Flags().String("profile", "", "Check artifacts with the specified profile")
checkCmd.Flags().BoolP("quiet", "q", false, "Do not print cargo log messages")
checkCmd.Flags().BoolP("release", "r", false, "Check artifacts in release mode, with optimizations")
checkCmd.Flags().StringSlice("target", []string{}, "Check for the target triple")
checkCmd.Flags().String("target-dir", "", "Directory for all generated artifacts")
checkCmd.Flags().StringSlice("test", []string{}, "Check only the specified test target")
checkCmd.Flags().Bool("tests", false, "Check all tests")
checkCmd.Flags().Bool("tests", false, "Check all test targets")
checkCmd.Flags().String("timings", "", "Timing output formats (unstable) (comma separated): html, json")
checkCmd.Flags().Bool("unit-graph", false, "Output build graph in JSON (unstable)")
checkCmd.Flags().Bool("workspace", false, "Check all packages in the workspace")
Expand Down
2 changes: 1 addition & 1 deletion completers/cargo_completer/cmd/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ func init() {
carapace.Gen(cleanCmd).Standalone()

cleanCmd.Flags().Bool("doc", false, "Whether or not to clean just the documentation directory")
cleanCmd.Flags().BoolP("dry-run", "n", false, "Display what would be deleted without deleting anything")
cleanCmd.Flags().BoolP("help", "h", false, "Print help")
cleanCmd.Flags().String("manifest-path", "", "Path to Cargo.toml")
cleanCmd.Flags().StringSliceP("package", "p", []string{}, "Package to clean artifacts for")
cleanCmd.Flags().String("profile", "", "Clean artifacts of the specified profile")
cleanCmd.Flags().BoolP("quiet", "q", false, "Do not print cargo log messages")
cleanCmd.Flags().BoolP("release", "r", false, "Whether or not to clean release artifacts")
cleanCmd.Flags().StringSlice("target", []string{}, "Target triple to clean output for")
cleanCmd.Flags().String("target-dir", "", "Directory for all generated artifacts")
Expand Down
6 changes: 2 additions & 4 deletions completers/cargo_completer/cmd/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

var docCmd = &cobra.Command{
Use: "doc",
Aliases: []string{"d"},
Short: "Build a package's documentation",
Run: func(cmd *cobra.Command, args []string) {},
GroupID: groupFor("doc"),
Expand All @@ -28,8 +27,8 @@ func init() {
docCmd.Flags().StringSliceP("features", "F", []string{}, "Space or comma separated list of features to activate")
docCmd.Flags().BoolP("help", "h", false, "Print help")
docCmd.Flags().Bool("ignore-rust-version", false, "Ignore `rust-version` specification in packages")
docCmd.Flags().StringP("jobs", "j", "", "Number of parallel jobs, defaults to # of CPUs")
docCmd.Flags().Bool("keep-going", false, "Do not abort the build as soon as there is an error (unstable)")
docCmd.Flags().StringP("jobs", "j", "", "Number of parallel jobs, defaults to # of CPUs.")
docCmd.Flags().Bool("keep-going", false, "Do not abort the build as soon as there is an error")
docCmd.Flags().Bool("lib", false, "Document only this package's library")
docCmd.Flags().String("manifest-path", "", "Path to Cargo.toml")
docCmd.Flags().StringSlice("message-format", []string{}, "Error format")
Expand All @@ -38,7 +37,6 @@ func init() {
docCmd.Flags().Bool("open", false, "Opens the docs in a browser after the operation")
docCmd.Flags().StringSliceP("package", "p", []string{}, "Package to document")
docCmd.Flags().String("profile", "", "Build artifacts with the specified profile")
docCmd.Flags().BoolP("quiet", "q", false, "Do not print cargo log messages")
docCmd.Flags().BoolP("release", "r", false, "Build artifacts in release mode, with optimizations")
docCmd.Flags().StringSlice("target", []string{}, "Build for the target triple")
docCmd.Flags().String("target-dir", "", "Directory for all generated artifacts")
Expand Down
3 changes: 1 addition & 2 deletions completers/cargo_completer/cmd/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

var fetchCmd = &cobra.Command{
Use: "fetch",
Short: "",
Short: "Fetch dependencies of a package from the network",
Run: func(cmd *cobra.Command, args []string) {},
GroupID: groupFor("fetch"),
}
Expand All @@ -17,7 +17,6 @@ func init() {

fetchCmd.Flags().BoolP("help", "h", false, "Print help")
fetchCmd.Flags().String("manifest-path", "", "Path to Cargo.toml")
fetchCmd.Flags().BoolP("quiet", "q", false, "Do not print cargo log messages")
fetchCmd.Flags().StringSlice("target", []string{}, "Fetch dependencies for the target triple")
rootCmd.AddCommand(fetchCmd)

Expand Down
9 changes: 4 additions & 5 deletions completers/cargo_completer/cmd/fix.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func init() {
fixCmd.Flags().Bool("allow-no-vcs", false, "Fix code even if a VCS was not detected")
fixCmd.Flags().Bool("allow-staged", false, "Fix code even if the working directory has staged changes")
fixCmd.Flags().StringSlice("bench", []string{}, "Fix only the specified bench target")
fixCmd.Flags().Bool("benches", false, "Fix all benches")
fixCmd.Flags().Bool("benches", false, "Fix all bench targets")
fixCmd.Flags().StringSlice("bin", []string{}, "Fix only the specified binary")
fixCmd.Flags().Bool("bins", false, "Fix all binaries")
fixCmd.Flags().Bool("broken-code", false, "Fix code even if it already has compiler errors")
Expand All @@ -35,20 +35,19 @@ func init() {
fixCmd.Flags().StringSliceP("features", "F", []string{}, "Space or comma separated list of features to activate")
fixCmd.Flags().BoolP("help", "h", false, "Print help")
fixCmd.Flags().Bool("ignore-rust-version", false, "Ignore `rust-version` specification in packages")
fixCmd.Flags().StringP("jobs", "j", "", "Number of parallel jobs, defaults to # of CPUs")
fixCmd.Flags().Bool("keep-going", false, "Do not abort the build as soon as there is an error (unstable)")
fixCmd.Flags().StringP("jobs", "j", "", "Number of parallel jobs, defaults to # of CPUs.")
fixCmd.Flags().Bool("keep-going", false, "Do not abort the build as soon as there is an error")
fixCmd.Flags().Bool("lib", false, "Fix only this package's library")
fixCmd.Flags().String("manifest-path", "", "Path to Cargo.toml")
fixCmd.Flags().StringSlice("message-format", []string{}, "Error format")
fixCmd.Flags().Bool("no-default-features", false, "Do not activate the `default` feature")
fixCmd.Flags().StringSliceP("package", "p", []string{}, "Package(s) to fix")
fixCmd.Flags().String("profile", "", "Build artifacts with the specified profile")
fixCmd.Flags().BoolP("quiet", "q", false, "Do not print cargo log messages")
fixCmd.Flags().BoolP("release", "r", false, "Fix artifacts in release mode, with optimizations")
fixCmd.Flags().StringSlice("target", []string{}, "Fix for the target triple")
fixCmd.Flags().String("target-dir", "", "Directory for all generated artifacts")
fixCmd.Flags().StringSlice("test", []string{}, "Fix only the specified test target")
fixCmd.Flags().Bool("tests", false, "Fix all tests")
fixCmd.Flags().Bool("tests", false, "Fix all test targets")
fixCmd.Flags().String("timings", "", "Timing output formats (unstable) (comma separated): html, json")
fixCmd.Flags().Bool("workspace", false, "Fix all packages in the workspace")
fixCmd.Flag("timings").NoOptDefVal = " "
Expand Down
2 changes: 1 addition & 1 deletion completers/cargo_completer/cmd/generateLockfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ func init() {
carapace.Gen(generateLockfileCmd).Standalone()

generateLockfileCmd.Flags().BoolP("help", "h", false, "Print help")
generateLockfileCmd.Flags().Bool("ignore-rust-version", false, "Ignore `rust-version` specification in packages (unstable)")
generateLockfileCmd.Flags().String("manifest-path", "", "Path to Cargo.toml")
generateLockfileCmd.Flags().BoolP("quiet", "q", false, "Do not print cargo log messages")
rootCmd.AddCommand(generateLockfileCmd)

carapace.Gen(generateLockfileCmd).FlagCompletion(carapace.ActionMap{
Expand Down
3 changes: 1 addition & 2 deletions completers/cargo_completer/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ func init() {
initCmd.Flags().BoolP("help", "h", false, "Print help")
initCmd.Flags().Bool("lib", false, "Use a library template")
initCmd.Flags().String("name", "", "Set the resulting package name, defaults to the directory name")
initCmd.Flags().BoolP("quiet", "q", false, "Do not print cargo log messages")
initCmd.Flags().String("registry", "", "Registry to use")
initCmd.Flags().String("vcs", "", "Initialize a new repository for the given version control system (git, hg, pijul, or fossil) or do not initialize any version control at all (none), overriding a global configuration.")
initCmd.Flags().String("vcs", "", "Initialize a new repository for the given version control system, overriding a global configuration.")
rootCmd.AddCommand(initCmd)

carapace.Gen(initCmd).FlagCompletion(carapace.ActionMap{
Expand Down
Loading

0 comments on commit aa570e3

Please sign in to comment.