From 69c034cdd4cf5875d62cf660f153ccfe6600a7be Mon Sep 17 00:00:00 2001 From: Greg Neiheisel <1036482+schnie@users.noreply.github.com> Date: Sun, 15 Dec 2024 17:12:18 -0500 Subject: [PATCH] Remove additional output when initializing project (#1766) --- cmd/airflow.go | 16 +--------------- cmd/airflow_test.go | 5 +---- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/cmd/airflow.go b/cmd/airflow.go index bc4413adf..366a61b87 100644 --- a/cmd/airflow.go +++ b/cmd/airflow.go @@ -103,7 +103,6 @@ astro dev init --from-template configReinitProjectConfigMsg = "Reinitialized existing Astro project in %s\n" configInitProjectConfigMsg = "Initialized empty Astro project in %s\n" - changeDirectoryMsg = "To begin developing, change to your project directory with `cd %s`\n" // this is used to monkey patch the function in order to write unit test cases containerHandlerInit = airflow.ContainerHandlerInit @@ -460,12 +459,6 @@ func airflowInit(cmd *cobra.Command, args []string) error { } projectName = name - // Save the directory we are in when the init command is run. - initialDir, err := fileutil.GetWorkingDir() - if err != nil { - return err - } - if fromTemplate == "select-template" { selectedTemplate, err := selectedTemplate() if err != nil { @@ -552,13 +545,6 @@ func airflowInit(cmd *cobra.Command, args []string) error { fmt.Printf(configInitProjectConfigMsg, config.WorkingPath) } - // If we started in a different directory, that means the positional argument for projectName was used. - // This means the users shell pwd is not the project directory, so we print a message - // to cd into the project directory. - if initialDir != config.WorkingPath { - fmt.Printf(changeDirectoryMsg, projectName) - } - return nil } @@ -580,7 +566,7 @@ func ensureProjectDirectory(args []string, workingPath, projectName string) (str // If the project directory does not exist, create it. if !projectDirExists { - err := os.Mkdir(newProjectPath, os.FileMode(directoryPermissions)) + err := os.Mkdir(newProjectPath, os.FileMode(directoryPermissions)) //nolint:gosec if err != nil { return "", err } diff --git a/cmd/airflow_test.go b/cmd/airflow_test.go index 8dd26ceef..93a007d0e 100644 --- a/cmd/airflow_test.go +++ b/cmd/airflow_test.go @@ -3,7 +3,6 @@ package cmd import ( "bytes" "errors" - "fmt" "io" "net/http" "os" @@ -481,16 +480,14 @@ func (s *AirflowSuite) TestAirflowInit() { orgStdout := os.Stdout defer func() { os.Stdout = orgStdout }() - r, w, _ := os.Pipe() + _, w, _ := os.Pipe() os.Stdout = w err := airflowInit(cmd, args) w.Close() - out, _ := io.ReadAll(r) s.NoError(err) - s.Contains(string(out), fmt.Sprintf(changeDirectoryMsg, args[0])) }) s.Run("specify flag and positional argument for project name, resulting in error", func() {