X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=cmd-projects.go;h=fc4bc2272e3561c96221477aeadc4815b82d0afe;hb=93f0511c5e5a215d27025510cf430c49ecf506cc;hp=13a71268669ab0faa003e8c69d8b47dfdf71fba8;hpb=f95aa5f0e39b85198655e8399c161fc5e6cd8a59;p=src%2Fxds%2Fxds-cli.git diff --git a/cmd-projects.go b/cmd-projects.go index 13a7126..fc4bc22 100644 --- a/cmd-projects.go +++ b/cmd-projects.go @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 "IoT.bzh" + * Copyright (C) 2017-2018 "IoT.bzh" * Author Sebastien Douheret * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +22,7 @@ import ( "fmt" "strings" - "github.com/iotbzh/xds-agent/lib/xaapiv1" + "gerrit.automotivelinux.org/gerrit/src/xds/xds-agent.git/lib/xaapiv1" "github.com/urfave/cli" ) @@ -63,8 +63,9 @@ func initCmdProjects(cmdDef *[]cli.Command) { Action: projectsGet, Flags: []cli.Flag{ cli.StringFlag{ - Name: "id", - Usage: "project id", + Name: "id", + Usage: "project id", + EnvVar: "XDS_PROJECT_ID", }, }, }, @@ -87,8 +88,13 @@ func initCmdProjects(cmdDef *[]cli.Command) { Action: projectsRemove, Flags: []cli.Flag{ cli.StringFlag{ - Name: "id", - Usage: "project id", + Name: "id", + Usage: "project id", + EnvVar: "XDS_PROJECT_ID", + }, + cli.BoolFlag{ + Name: "force, f", + Usage: "remove confirmation prompt before removal", }, }, }, @@ -99,8 +105,9 @@ func initCmdProjects(cmdDef *[]cli.Command) { Action: projectsSync, Flags: []cli.Flag{ cli.StringFlag{ - Name: "id", - Usage: "project id", + Name: "id", + Usage: "project id", + EnvVar: "XDS_PROJECT_ID", }, }, }, @@ -206,6 +213,12 @@ func projectsRemove(ctx *cli.Context) error { return cli.NewExitError("id parameter or option must be set", 1) } + if !ctx.Bool("force") { + if !Confirm("Do you permanently remove project id '" + id + "' [yes/No] ? ") { + return nil + } + } + if err := HTTPCli.Delete("/projects/"+id, &res); err != nil { return cli.NewExitError(err, 1) }