Skip to content

Commit

Permalink
Updates the error output for an empty directory (#5610)
Browse files Browse the repository at this point in the history
<!--
Thank you for opening a PR! Here are some things you need to know before submitting:

1. Please read our developer guideline: https://github.com/redhat-developer/odo/wiki/Dev:-odo-Dev-Guidelines
2. Label this PR accordingly with the '/kind' line
3. Ensure you have written and ran the appropriate tests: https://github.com/redhat-developer/odo/wiki/Dev:-Writing-and-running-tests
4. Read how we approve and LGTM each PR: https://github.com/redhat-developer/odo/wiki/Pull-Requests:-Review-guideline

Documentation:

If you are pushing a change to documentation, please read: https://github.com/redhat-developer/odo/wiki/Documentation:-Contributing
-->

**What type of PR is this:**

<!--
Add one of the following kinds:
/kind bug
/kind feature
/kind cleanup
/kind tests
/kind documentation

Feel free to use other [labels](https://github.com/redhat-developer/odo/labels) as needed. However one of the above labels must be present or the PR will not be reviewed. This instruction is for reviewers as well.
-->

**What does this PR do / why we need it:**

Updates the error output for running `odo dev` or `odo deploy` in an
empty directory. Telling the user to run the same command in a non-empty
dir, OR use `odo init`.

**Which issue(s) this PR fixes:**
<!--
Specifying the issue will automatically close it when this PR is merged
-->

N/A

**PR acceptance criteria:**

- [X] Unit test

- [X] Integration test

- [X] Documentation

**How to test changes / Special notes to the reviewer:**

Signed-off-by: Charlie Drage <[email protected]>
  • Loading branch information
cdrage authored Apr 1, 2022
1 parent 851b2f3 commit 0d06d8e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/odo/cli/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (o *DeployOptions) Complete(cmdline cmdline.Cmdline, args []string) (err er
return err
}
if isEmptyDir {
return errors.New("this command cannot run in an empty directory, you need to run it in a directory containing source code")
return errors.New("this command cannot run in an empty directory, run the command in a directory containing source code or initialize using 'odo init'")
}

initFlags := o.clientset.InitClient.GetFlags(cmdline.GetFlags())
Expand Down
2 changes: 1 addition & 1 deletion pkg/odo/cli/dev/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (o *DevOptions) Complete(cmdline cmdline.Cmdline, args []string) error {
return err
}
if isEmptyDir {
return errors.New("this command cannot run in an empty directory, you need to run it in a directory containing source code")
return errors.New("this command cannot run in an empty directory, run the command in a directory containing source code or initialize using 'odo init'")
}
initFlags := o.clientset.InitClient.GetFlags(cmdline.GetFlags())
err = o.clientset.InitClient.InitDevfile(initFlags, o.contextDir,
Expand Down

0 comments on commit 0d06d8e

Please sign in to comment.