haskell / haskell/cabal

`cabal clean` should fail if not in a cabal directory

Open
#9,746 3 comments 8 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.