GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — add error msg for invalid -e option · PastureStack/cli@65884ff

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • cmd
    • run.go
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎cmd/run.go‎

Copy file name to clipboardExpand all lines: cmd/run.go
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
"github.com/rancher/go-rancher/v2"
77

8+
"fmt"
89
"github.com/urfave/cli"
910
"os"
1011
)
@@ -294,8 +295,14 @@ func serviceRun(ctx *cli.Context) error {
294295
for _, env := range ctx.StringSlice("env") {
295296
parts := strings.SplitN(env, "=", 2)
296297
value := ""
298+
297299
if len(parts) > 1 {
298300
value = parts[1]
301+
302+
if parts[0] == "" {
303+
errMsg := fmt.Sprintf("invalid argument \"%s\" for e: invalid environment variable: %s\nSee 'rancher run --help'.", env, env)
304+
return cli.NewExitError(errMsg, 1)
305+
}
299306
} else if len(parts) == 1 {
300307
value = os.Getenv(parts[0])
301308
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.