Skip to content

Commit db4c149

Browse files
committed
Removed useless version param on 'core uninstall'
1 parent f01bf30 commit db4c149

File tree

6 files changed

+67
-70
lines changed

6 files changed

+67
-70
lines changed

cli/core/args.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ type platformReferenceArg struct {
3232
Version string
3333
}
3434

35+
func (pl *platformReferenceArg) String() string {
36+
if pl.Version != "" {
37+
return pl.Package + ":" + pl.Architecture + "@" + pl.Version
38+
}
39+
return pl.Package + ":" + pl.Architecture
40+
}
41+
3542
// parsePlatformReferenceArgs parses a sequence of "packager:arch@version" tokens and
3643
// returns a platformReferenceArg slice.
3744
func parsePlatformReferenceArgs(args []string) []*platformReferenceArg {

cli/core/uninstall.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232

3333
func initUninstallCommand() *cobra.Command {
3434
return &cobra.Command{
35-
Use: "uninstall PACKAGER:ARCH[@VERSION] ...",
35+
Use: "uninstall PACKAGER:ARCH ...",
3636
Short: "Uninstalls one or more cores and corresponding tool dependencies if no more used.",
3737
Long: "Uninstalls one or more cores and corresponding tool dependencies if no more used.",
3838
Example: " " + cli.AppName + " core uninstall arduino:samd\n",
@@ -47,12 +47,17 @@ func runUninstallCommand(cmd *cobra.Command, args []string) {
4747

4848
platformsRefs := parsePlatformReferenceArgs(args)
4949

50+
for _, platformRef := range platformsRefs {
51+
if platformRef.Version != "" {
52+
formatter.PrintErrorMessage("Invalid parameter " + platformRef.String() + ": version not allowed")
53+
os.Exit(cli.ErrBadArgument)
54+
}
55+
}
5056
for _, platformRef := range platformsRefs {
5157
_, err := core.PlatformUninstall(context.Background(), &rpc.PlatformUninstallReq{
5258
Instance: instance,
5359
PlatformPackage: platformRef.Package,
5460
Architecture: platformRef.Architecture,
55-
Version: platformRef.Version,
5661
}, output.NewTaskProgressCB())
5762
if err != nil {
5863
formatter.PrintError(err, "Error during uninstall")

commands/core/uninstall.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,10 @@ func PlatformUninstall(ctx context.Context, req *rpc.PlatformUninstallReq, taskC
3434
return nil, errors.New("invalid instance")
3535
}
3636

37-
// If no version is specified consider the installed
38-
version, err := commands.ParseVersion(req)
39-
if err != nil {
40-
return nil, fmt.Errorf("invalid version: %s", err)
41-
}
42-
4337
ref := &packagemanager.PlatformReference{
4438
Package: req.PlatformPackage,
4539
PlatformArchitecture: req.Architecture,
46-
PlatformVersion: version}
40+
}
4741
if ref.PlatformVersion == nil {
4842
platform := pm.FindPlatform(ref)
4943
if platform == nil {

daemon/client/client.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@ func main() {
342342
Instance: instance,
343343
PlatformPackage: "arduino",
344344
Architecture: "samd",
345-
//Version: "1.6.19",
346345
})
347346
if err != nil {
348347
fmt.Printf("Uninstall error: %s\n", err)

rpc/core.pb.go

Lines changed: 52 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rpc/core.proto

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ message PlatformUninstallReq {
5050
Instance instance = 1;
5151
string platform_package = 2;
5252
string architecture = 3;
53-
string version = 4;
5453
}
5554

5655
message PlatformUninstallResp {

0 commit comments

Comments
 (0)