# ant remove

```sh
ant remove <name>...
```

`ant remove` takes names of the project file, `ant.json`, and removes their entries. It then selects
the versions of the packages that are left and writes `ant.lock`.

A project with two entries, and a program that uses one of them:

```json [ant.json]
{
  "dependencies": {
    "slug": "example.com/slug@2.0.0",
    "slug1": "example.com/slug@1.2.0"
  }
}
```


```ant [main.ant]
import "slug" Slug

println(Slug.make("Hello, Ant"))
```

`ant remove slug1` takes the entry out of `ant.json` and prints the line that left the lock:

```text
- example.com/slug 1.2.0
```

- The name is the one in `ant.json`, under `dependencies` or `devDependencies`, not the path of the
  package.
- Standard output lists the lines that left the lock. A package that another package still asks for
  stays in the lock.
- When the last entry goes, the project needs no lock, and `ant remove` deletes `ant.lock`.
- It changes all or nothing: with a name that is not in the file, it removes none.
- The store keeps the files of the package. Other projects may use them.
- `ant remove` fetches nothing when the store holds the packages that are left.

An import of the name then fails, and the program does not load:

```ant
import "slug1" Slug1
// error: cannot import "slug1": the project file ant.json has no dependency named slug1
```

## Exit status

| Exit status | When                                                                                            |
| ----------- | ----------------------------------------------------------------------------------------------- |
| `0`         | the files were written                                                                          |
| `1`         | a name is not a dependency, or there is no project file                                         |
| `2`         | the usage is wrong: an unknown flag, no name, or an argument that is not a name, such as a path |

## See also

[Packages](https://ant-lang.org/docs/guide/packages.md), [`ant add`](https://ant-lang.org/docs/tools/add.md), [`ant update`](https://ant-lang.org/docs/tools/update.md),
[`ant lock`](https://ant-lang.org/docs/tools/lock.md)
