`cabal clean` should fail if not in a cabal directory
Open
attention: pr-welcome
cabal-install: cmd/clean
type: bug
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
**Describe the bug**
Currently the `cabal clean` command will silently fail if the directory is not a cabal one. This can be confusing in some situations. I've asked people to "`cabal clean` and try again", and turns out they were performing this in the root directory of the whole project, rather than the directory containing our Haskell code. If `cabal clean` produced an error in such situations, this would have helped.
**To Reproduce**
Call `cabal clean` in a non-cabal directory.
**Expected behavior**
The same behaviour as e.g. `cabal build`:
```
Error: cabal: There is no .cabal package file or cabal.project file.
```
Contributor guide
Assessment
This issue has not been assessed yet.