From 5da11447aad6d8a76ccb5cfec8e882a02d617662 Mon Sep 17 00:00:00 2001 From: Jens Feodor Nielsen Date: Mon, 10 Jun 2024 17:04:01 +0200 Subject: [PATCH] review changes --- cli/cmd/deploy/cmd.go | 4 ++-- cli/cmd/deploy/deploy.go | 1 + cli/cmd/output/task.go | 2 +- cli/cmd/push/push.go | 4 ++-- cli/testdata/streamlit_app/.gitignore | 1 - 5 files changed, 6 insertions(+), 6 deletions(-) delete mode 100644 cli/testdata/streamlit_app/.gitignore diff --git a/cli/cmd/deploy/cmd.go b/cli/cmd/deploy/cmd.go index 42fdc65..29bd91c 100644 --- a/cli/cmd/deploy/cmd.go +++ b/cli/cmd/deploy/cmd.go @@ -1,7 +1,7 @@ package deploy import ( - "errors" + "fmt" "net/http" "os" @@ -39,7 +39,7 @@ be pushed to the organization "organization-slug-a3ecfh2b", and the app name fn := cmd.HelpFunc() fn(cmd, args) - return errors.New("only accepts zero or one positional arguments") + return fmt.Errorf("accepts only an optional [app directory] as a positional argument, you provided %d arguments", len(args)) } if len(args) == 1 { diff --git a/cli/cmd/deploy/deploy.go b/cli/cmd/deploy/deploy.go index f7c366b..85149ab 100644 --- a/cli/cmd/deploy/deploy.go +++ b/cli/cmd/deploy/deploy.go @@ -95,6 +95,7 @@ func Deploy(ctx context.Context, apps AppService, appDir, projectDir, slug strin return err } + defer archive.Close() task.Done() task = output.StartTask("Uploading app archive") diff --git a/cli/cmd/output/task.go b/cli/cmd/output/task.go index 5bc592d..3311966 100644 --- a/cli/cmd/output/task.go +++ b/cli/cmd/output/task.go @@ -42,7 +42,7 @@ func (t *Task) Done() { fmt.Println(ln + ansiGreen + "OK" + ansiReset) } -func (t Task) Error() { +func (t *Task) Error() { ln := t.line(errorcross) if !t.lineAdded { fmt.Print("\r") diff --git a/cli/cmd/push/push.go b/cli/cmd/push/push.go index 7b94447..498e8f0 100644 --- a/cli/cmd/push/push.go +++ b/cli/cmd/push/push.go @@ -168,7 +168,7 @@ func buildApp(buildID string, appPath string) (ok bool) { func uploadApp(appDir string, toolID string) (buildID string, ok bool) { defer os.Remove(zipFileName) - task := output.StartTask("Uploading app......") + task := output.StartTask("Uploading app") secrets := loadSecretsFromEnv(appDir) buildID, err := pushBuild(zipFileName, string(toolID), secrets) @@ -194,7 +194,7 @@ func uploadApp(appDir string, toolID string) (buildID string, ok bool) { } func prepareApp(m *manifest.Manifest) (ok bool) { - task := output.StartTask("Preparing upload...") + task := output.StartTask("Preparing upload.") if err := archive.ZipCreate(".", zipFileName, m.Exclude); err != nil { output.PrintErrorDetails("Error preparing app.", err) diff --git a/cli/testdata/streamlit_app/.gitignore b/cli/testdata/streamlit_app/.gitignore deleted file mode 100644 index 3199f63..0000000 --- a/cli/testdata/streamlit_app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.tool_id.txt