@@ -145,3 +145,47 @@ func FileNames(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCom
145145func NoComplete (_ * cobra.Command , _ []string , _ string ) ([]string , cobra.ShellCompDirective ) {
146146 return nil , cobra .ShellCompDirectiveNoFileComp
147147}
148+
149+ var commonPlatforms = []string {
150+ "linux" ,
151+ "linux/386" ,
152+ "linux/amd64" ,
153+ "linux/arm" ,
154+ "linux/arm/v5" ,
155+ "linux/arm/v6" ,
156+ "linux/arm/v7" ,
157+ "linux/arm64" ,
158+ "linux/arm64/v8" ,
159+
160+ // IBM power and z platforms
161+ "linux/ppc64le" ,
162+ "linux/s390x" ,
163+
164+ // Not yet supported
165+ "linux/riscv64" ,
166+
167+ "windows" ,
168+ "windows/amd64" ,
169+
170+ "wasip1" ,
171+ "wasip1/wasm" ,
172+ }
173+
174+ // Platforms offers completion for platform-strings. It provides a non-exhaustive
175+ // list of platforms to be used for completion. Platform-strings are based on
176+ // [runtime.GOOS] and [runtime.GOARCH], but with (optional) variants added. A
177+ // list of recognised os/arch combinations from the Go runtime can be obtained
178+ // through "go tool dist list".
179+ //
180+ // Some noteworthy exclusions from this list:
181+ //
182+ // - arm64 images ("windows/arm64", "windows/arm64/v8") do not yet exist for windows.
183+ // - we don't (yet) include `os-variant` for completion (as can be used for Windows images)
184+ // - we don't (yet) include platforms for which we don't build binaries, such as
185+ // BSD platforms (freebsd, netbsd, openbsd), android, macOS (darwin).
186+ // - we currently exclude architectures that may have unofficial builds,
187+ // but don't have wide adoption (and no support), such as loong64, mipsXXX,
188+ // ppc64 (non-le) to prevent confusion.
189+ func Platforms (_ * cobra.Command , _ []string , _ string ) (platforms []string , _ cobra.ShellCompDirective ) {
190+ return commonPlatforms , cobra .ShellCompDirectiveNoFileComp
191+ }
0 commit comments