Skip to content

Commit a6af024

Browse files
committed
cargo: updates from 0.91.0
1 parent cf520a5 commit a6af024

28 files changed

+105
-68
lines changed

completers/common/cargo_completer/cmd/add.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ var addCmd = &cobra.Command{
2121
func init() {
2222
carapace.Gen(addCmd).Standalone()
2323

24+
addCmd.Flags().String("base", "", "The path base to use when adding from a local crate (unstable).")
2425
addCmd.Flags().String("branch", "", "Git branch to download the crate from")
2526
addCmd.Flags().Bool("build", false, "Add as build dependency")
2627
addCmd.Flags().Bool("default-features", false, "Re-enable the default features")
@@ -30,6 +31,7 @@ func init() {
3031
addCmd.Flags().String("git", "", "Git repository location")
3132
addCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
3233
addCmd.Flags().Bool("ignore-rust-version", false, "Ignore `rust-version` specification in packages")
34+
addCmd.Flags().String("lockfile-path", "", "Path to Cargo.lock (unstable)")
3335
addCmd.Flags().String("manifest-path", "", "Path to Cargo.toml")
3436
addCmd.Flags().Bool("no-default-features", false, "Disable the default features")
3537
addCmd.Flags().Bool("no-optional", false, "Mark the dependency as required")
@@ -63,6 +65,7 @@ func init() {
6365
"git": carapace.ActionCallback(func(c carapace.Context) carapace.Action {
6466
return git.ActionRepositorySearch(git.SearchOpts{}.Default())
6567
}),
68+
"lockfile-path": carapace.ActionFiles(),
6669
"manifest-path": carapace.ActionFiles(),
6770
"package": action.ActionDependencies(addCmd, true),
6871
"path": carapace.ActionDirectories(),

completers/common/cargo_completer/cmd/bench.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func init() {
2020
benchCmd.Flags().Bool("all-features", false, "Activate all available features")
2121
benchCmd.Flags().Bool("all-targets", false, "Benchmark all targets")
2222
benchCmd.Flags().StringSlice("bench", nil, "Benchmark only the specified bench target")
23-
benchCmd.Flags().Bool("benches", false, "Benchmark all bench targets")
23+
benchCmd.Flags().Bool("benches", false, "Benchmark all targets that have `bench = true` set")
2424
benchCmd.Flags().StringSlice("bin", nil, "Benchmark only the specified binary")
2525
benchCmd.Flags().Bool("bins", false, "Benchmark all binaries")
2626
benchCmd.Flags().StringSlice("example", nil, "Benchmark only the specified example")
@@ -31,6 +31,7 @@ func init() {
3131
benchCmd.Flags().Bool("ignore-rust-version", false, "Ignore `rust-version` specification in packages")
3232
benchCmd.Flags().StringP("jobs", "j", "", "Number of parallel jobs, defaults to # of CPUs.")
3333
benchCmd.Flags().Bool("lib", false, "Benchmark only this package's library")
34+
benchCmd.Flags().String("lockfile-path", "", "Path to Cargo.lock (unstable)")
3435
benchCmd.Flags().String("manifest-path", "", "Path to Cargo.toml")
3536
benchCmd.Flags().StringSlice("message-format", nil, "Error format")
3637
benchCmd.Flags().Bool("no-default-features", false, "Do not activate the `default` feature")
@@ -41,7 +42,7 @@ func init() {
4142
benchCmd.Flags().StringSlice("target", nil, "Build for the target triple")
4243
benchCmd.Flags().String("target-dir", "", "Directory for all generated artifacts")
4344
benchCmd.Flags().StringSlice("test", nil, "Benchmark only the specified test target")
44-
benchCmd.Flags().Bool("tests", false, "Benchmark all test targets")
45+
benchCmd.Flags().Bool("tests", false, "Benchmark all targets that have `test = true` set")
4546
benchCmd.Flags().String("timings", "", "Timing output formats (unstable) (comma separated): html, json")
4647
benchCmd.Flags().Bool("unit-graph", false, "Output build graph in JSON (unstable)")
4748
benchCmd.Flags().Bool("workspace", false, "Benchmark all packages in the workspace")
@@ -54,6 +55,7 @@ func init() {
5455
"example": action.ActionTargets(benchCmd, action.TargetOpts{Example: true}),
5556
"exclude": action.ActionWorkspaceMembers(benchCmd),
5657
"features": action.ActionFeatures(benchCmd).UniqueList(","),
58+
"lockfile-path": carapace.ActionFiles(),
5759
"manifest-path": carapace.ActionFiles(),
5860
"message-format": action.ActionMessageFormats(),
5961
"package": action.ActionDependencies(benchCmd, true),

completers/common/cargo_completer/cmd/build.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func init() {
2121
buildCmd.Flags().Bool("all-targets", false, "Build all targets")
2222
buildCmd.Flags().String("artifact-dir", "", "Copy final artifacts to this directory (unstable)")
2323
buildCmd.Flags().StringSlice("bench", nil, "Build only the specified bench target")
24-
buildCmd.Flags().Bool("benches", false, "Build all bench targets")
24+
buildCmd.Flags().Bool("benches", false, "Build all targets that have `bench = true` set")
2525
buildCmd.Flags().StringSlice("bin", nil, "Build only the specified binary")
2626
buildCmd.Flags().Bool("bins", false, "Build all binaries")
2727
buildCmd.Flags().Bool("build-plan", false, "Output the build plan in JSON (unstable)")
@@ -35,6 +35,7 @@ func init() {
3535
buildCmd.Flags().StringP("jobs", "j", "", "Number of parallel jobs, defaults to # of CPUs.")
3636
buildCmd.Flags().Bool("keep-going", false, "Do not abort the build as soon as there is an error")
3737
buildCmd.Flags().Bool("lib", false, "Build only this package's library")
38+
buildCmd.Flags().String("lockfile-path", "", "Path to Cargo.lock (unstable)")
3839
buildCmd.Flags().String("manifest-path", "", "Path to Cargo.toml")
3940
buildCmd.Flags().StringSlice("message-format", nil, "Error format")
4041
buildCmd.Flags().Bool("no-default-features", false, "Do not activate the `default` feature")
@@ -44,7 +45,7 @@ func init() {
4445
buildCmd.Flags().StringSlice("target", nil, "Build for the target triple")
4546
buildCmd.Flags().String("target-dir", "", "Directory for all generated artifacts")
4647
buildCmd.Flags().StringSlice("test", nil, "Build only the specified test target")
47-
buildCmd.Flags().Bool("tests", false, "Build all test targets")
48+
buildCmd.Flags().Bool("tests", false, "Build all targets that have `test = true` set")
4849
buildCmd.Flags().String("timings", "", "Timing output formats (unstable) (comma separated): html, json")
4950
buildCmd.Flags().Bool("unit-graph", false, "Output build graph in JSON (unstable)")
5051
buildCmd.Flags().Bool("workspace", false, "Build all packages in the workspace")
@@ -58,6 +59,7 @@ func init() {
5859
"example": action.ActionTargets(buildCmd, action.TargetOpts{Example: true}),
5960
"exclude": action.ActionWorkspaceMembers(buildCmd),
6061
"features": action.ActionFeatures(buildCmd).UniqueList(","),
62+
"lockfile-path": carapace.ActionFiles(),
6163
"manifest-path": carapace.ActionFiles(),
6264
"message-format": action.ActionMessageFormats(),
6365
"package": action.ActionDependencies(buildCmd, true),

completers/common/cargo_completer/cmd/check.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func init() {
2020
checkCmd.Flags().Bool("all-features", false, "Activate all available features")
2121
checkCmd.Flags().Bool("all-targets", false, "Check all targets")
2222
checkCmd.Flags().StringSlice("bench", nil, "Check only the specified bench target")
23-
checkCmd.Flags().Bool("benches", false, "Check all bench targets")
23+
checkCmd.Flags().Bool("benches", false, "Check all targets that have `bench = true` set")
2424
checkCmd.Flags().StringSlice("bin", nil, "Check only the specified binary")
2525
checkCmd.Flags().Bool("bins", false, "Check all binaries")
2626
checkCmd.Flags().StringSlice("example", nil, "Check only the specified example")
@@ -33,6 +33,7 @@ func init() {
3333
checkCmd.Flags().StringP("jobs", "j", "", "Number of parallel jobs, defaults to # of CPUs.")
3434
checkCmd.Flags().Bool("keep-going", false, "Do not abort the build as soon as there is an error")
3535
checkCmd.Flags().Bool("lib", false, "Check only this package's library")
36+
checkCmd.Flags().String("lockfile-path", "", "Path to Cargo.lock (unstable)")
3637
checkCmd.Flags().String("manifest-path", "", "Path to Cargo.toml")
3738
checkCmd.Flags().StringSlice("message-format", nil, "Error format")
3839
checkCmd.Flags().Bool("no-default-features", false, "Do not activate the `default` feature")
@@ -42,7 +43,7 @@ func init() {
4243
checkCmd.Flags().StringSlice("target", nil, "Check for the target triple")
4344
checkCmd.Flags().String("target-dir", "", "Directory for all generated artifacts")
4445
checkCmd.Flags().StringSlice("test", nil, "Check only the specified test target")
45-
checkCmd.Flags().Bool("tests", false, "Check all test targets")
46+
checkCmd.Flags().Bool("tests", false, "Check all targets that have `test = true` set")
4647
checkCmd.Flags().String("timings", "", "Timing output formats (unstable) (comma separated): html, json")
4748
checkCmd.Flags().Bool("unit-graph", false, "Output build graph in JSON (unstable)")
4849
checkCmd.Flags().Bool("workspace", false, "Check all packages in the workspace")
@@ -55,6 +56,7 @@ func init() {
5556
"example": action.ActionTargets(checkCmd, action.TargetOpts{Example: true}),
5657
"exclude": action.ActionWorkspaceMembers(checkCmd),
5758
"features": action.ActionFeatures(checkCmd).UniqueList(","),
59+
"lockfile-path": carapace.ActionFiles(),
5860
"manifest-path": carapace.ActionFiles(),
5961
"message-format": action.ActionMessageFormats(),
6062
"package": action.ActionDependencies(buildCmd, true),

completers/common/cargo_completer/cmd/clean.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ func init() {
1919
cleanCmd.Flags().Bool("doc", false, "Whether or not to clean just the documentation directory")
2020
cleanCmd.Flags().BoolP("dry-run", "n", false, "Display what would be deleted without deleting anything")
2121
cleanCmd.Flags().BoolP("help", "h", false, "Print help")
22+
cleanCmd.Flags().String("lockfile-path", "", "Path to Cargo.lock (unstable)")
2223
cleanCmd.Flags().String("manifest-path", "", "Path to Cargo.toml")
2324
cleanCmd.Flags().StringSliceP("package", "p", nil, "Package to clean artifacts for")
2425
cleanCmd.Flags().String("profile", "", "Clean artifacts of the specified profile")
@@ -28,6 +29,7 @@ func init() {
2829
rootCmd.AddCommand(cleanCmd)
2930

3031
carapace.Gen(cleanCmd).FlagCompletion(carapace.ActionMap{
32+
"lockfile-path": carapace.ActionFiles(),
3133
"manifest-path": carapace.ActionFiles(),
3234
"package": action.ActionDependencies(cleanCmd, true),
3335
"profile": action.ActionProfiles(cleanCmd),

completers/common/cargo_completer/cmd/doc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ func init() {
3030
docCmd.Flags().StringP("jobs", "j", "", "Number of parallel jobs, defaults to # of CPUs.")
3131
docCmd.Flags().Bool("keep-going", false, "Do not abort the build as soon as there is an error")
3232
docCmd.Flags().Bool("lib", false, "Document only this package's library")
33+
docCmd.Flags().String("lockfile-path", "", "Path to Cargo.lock (unstable)")
3334
docCmd.Flags().String("manifest-path", "", "Path to Cargo.toml")
3435
docCmd.Flags().StringSlice("message-format", nil, "Error format")
3536
docCmd.Flags().Bool("no-default-features", false, "Do not activate the `default` feature")
@@ -50,6 +51,7 @@ func init() {
5051
"bin": action.ActionTargets(docCmd, action.TargetOpts{Bin: true}),
5152
"exclude": action.ActionWorkspaceMembers(docCmd),
5253
"features": action.ActionFeatures(docCmd).UniqueList(","),
54+
"lockfile-path": carapace.ActionFiles(),
5355
"manifest-path": carapace.ActionFiles(),
5456
"message-format": action.ActionMessageFormats(),
5557
"package": action.ActionDependencies(docCmd, true),

completers/common/cargo_completer/cmd/fetch.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ func init() {
1616
carapace.Gen(fetchCmd).Standalone()
1717

1818
fetchCmd.Flags().BoolP("help", "h", false, "Print help")
19+
fetchCmd.Flags().String("lockfile-path", "", "Path to Cargo.lock (unstable)")
1920
fetchCmd.Flags().String("manifest-path", "", "Path to Cargo.toml")
2021
fetchCmd.Flags().StringSlice("target", nil, "Fetch dependencies for the target triple")
2122
rootCmd.AddCommand(fetchCmd)
2223

2324
carapace.Gen(fetchCmd).FlagCompletion(carapace.ActionMap{
25+
"lockfile-path": carapace.ActionFiles(),
2426
"manifest-path": carapace.ActionFiles(),
2527
})
2628
}

completers/common/cargo_completer/cmd/fix.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ func init() {
1919
fixCmd.Flags().Bool("all", false, "Alias for --workspace (deprecated)")
2020
fixCmd.Flags().Bool("all-features", false, "Activate all available features")
2121
fixCmd.Flags().Bool("all-targets", false, "Fix all targets (default)")
22-
fixCmd.Flags().Bool("allow-dirty", false, "Fix code even if the working directory is dirty")
22+
fixCmd.Flags().Bool("allow-dirty", false, "Fix code even if the working directory is dirty or has staged changes")
2323
fixCmd.Flags().Bool("allow-no-vcs", false, "Fix code even if a VCS was not detected")
2424
fixCmd.Flags().Bool("allow-staged", false, "Fix code even if the working directory has staged changes")
2525
fixCmd.Flags().StringSlice("bench", nil, "Fix only the specified bench target")
26-
fixCmd.Flags().Bool("benches", false, "Fix all bench targets")
26+
fixCmd.Flags().Bool("benches", false, "Fix all targets that have `bench = true` set")
2727
fixCmd.Flags().StringSlice("bin", nil, "Fix only the specified binary")
2828
fixCmd.Flags().Bool("bins", false, "Fix all binaries")
2929
fixCmd.Flags().Bool("broken-code", false, "Fix code even if it already has compiler errors")
@@ -38,6 +38,7 @@ func init() {
3838
fixCmd.Flags().StringP("jobs", "j", "", "Number of parallel jobs, defaults to # of CPUs.")
3939
fixCmd.Flags().Bool("keep-going", false, "Do not abort the build as soon as there is an error")
4040
fixCmd.Flags().Bool("lib", false, "Fix only this package's library")
41+
fixCmd.Flags().String("lockfile-path", "", "Path to Cargo.lock (unstable)")
4142
fixCmd.Flags().String("manifest-path", "", "Path to Cargo.toml")
4243
fixCmd.Flags().StringSlice("message-format", nil, "Error format")
4344
fixCmd.Flags().Bool("no-default-features", false, "Do not activate the `default` feature")
@@ -47,7 +48,7 @@ func init() {
4748
fixCmd.Flags().StringSlice("target", nil, "Fix for the target triple")
4849
fixCmd.Flags().String("target-dir", "", "Directory for all generated artifacts")
4950
fixCmd.Flags().StringSlice("test", nil, "Fix only the specified test target")
50-
fixCmd.Flags().Bool("tests", false, "Fix all test targets")
51+
fixCmd.Flags().Bool("tests", false, "Fix all targets that have `test = true` set")
5152
fixCmd.Flags().String("timings", "", "Timing output formats (unstable) (comma separated): html, json")
5253
fixCmd.Flags().Bool("workspace", false, "Fix all packages in the workspace")
5354
fixCmd.Flag("timings").NoOptDefVal = " "
@@ -59,6 +60,7 @@ func init() {
5960
"example": action.ActionTargets(fixCmd, action.TargetOpts{Example: true}),
6061
"exclude": action.ActionWorkspaceMembers(fixCmd),
6162
"features": action.ActionFeatures(fixCmd).UniqueList(","),
63+
"lockfile-path": carapace.ActionFiles(),
6264
"manifest-path": carapace.ActionFiles(),
6365
"message-format": action.ActionMessageFormats(),
6466
"package": action.ActionDependencies(fixCmd, true),

completers/common/cargo_completer/cmd/generateLockfile.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ func init() {
1515
carapace.Gen(generateLockfileCmd).Standalone()
1616

1717
generateLockfileCmd.Flags().BoolP("help", "h", false, "Print help")
18-
generateLockfileCmd.Flags().Bool("ignore-rust-version", false, "Ignore `rust-version` specification in packages (unstable)")
18+
generateLockfileCmd.Flags().Bool("ignore-rust-version", false, "Ignore `rust-version` specification in packages")
19+
generateLockfileCmd.Flags().String("lockfile-path", "", "Path to Cargo.lock (unstable)")
1920
generateLockfileCmd.Flags().String("manifest-path", "", "Path to Cargo.toml")
2021
rootCmd.AddCommand(generateLockfileCmd)
2122

2223
carapace.Gen(generateLockfileCmd).FlagCompletion(carapace.ActionMap{
24+
"lockfile-path": carapace.ActionFiles(),
2325
"manifest-path": carapace.ActionFiles(),
2426
})
2527
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var infoCmd = &cobra.Command{
9+
Use: "info",
10+
Short: "Display information about a package",
11+
Run: func(cmd *cobra.Command, args []string) {},
12+
}
13+
14+
func init() {
15+
carapace.Gen(infoCmd).Standalone()
16+
17+
infoCmd.Flags().BoolP("help", "h", false, "Print help")
18+
infoCmd.Flags().String("index", "", "Registry index URL to search packages in")
19+
infoCmd.Flags().String("registry", "", "Registry to search packages in")
20+
rootCmd.AddCommand(infoCmd)
21+
22+
// TODO completion
23+
}

0 commit comments

Comments
 (0)