Skip to content

cabal clean should fail if not in a cabal directory #9746

@jameshaydon

Description

@jameshaydon

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 <pkgname>.cabal package file or cabal.project file.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions