<commit_before># CSTOW tests

This file contains all tests for _cstow_. To run it, execute `make
test` in this or the parent directory. If everything goes well, no
output should be produced.

In the tests, I assume a sample `pkg` package exists:

```sh
$ mkdir -p packages/pkg/d0/d1
$ touch packages/pkg/d0/f0
$ touch packages/pkg/d0/d1/f1
```

## Executing CSTOW with no arguments

CStow expects at least a non-flag argument, the package to
install. Executing `cstow` with no arguments will fail with a non-zero
exit status and will show a brief usage message.

```sh
$ cstow
@ Usage: cstow [-cdDhnRtv] <package-name>
@   -c,     Do not exit when a conflict is found, continue as if
@           nothing happened.  This options implies -n.
@   -d DIR, Set the package directory to DIR.  If not
@           specified the current directory will be used.
@   -D,     Delete the package instead of installing it.
@   -h,     Show this help message.
@   -n,     Do not perform any of the operations, only pretend.
@           Useful for detecting errors without damaging anything.
@   -R,     Reinstall a package.  Equivalent to invoking cstow
@           to install and deinstall in sequence.
@   -t DIR, Set the target directory to DIR.  If not
@           specified the parent directory will be used.
@   -v,     Be verbose, showing each operation performed.
? 1
```

## Getting help

When given the `-h` flag, `cstow` will show a usage message and exit
with a success status (0).

```sh
$ cstow -h
| Usage: cstow [-cdDhnRtv] <package-name>
|   -c,     Do not exit when a conflict is found, continue as if
|           nothing happened.  This options implies -n.
|   -d DIR, Set the package directory to DIR.  If not
|           specified the current directory will be used.
|   -D,     Delete the package instead of installing it.
|   -h,     Show this help message.
|   -n,     Do not perform any of the operations, only pretend.
|           Useful for detecting errors without damaging anything.
|   -R,     Reinstall a package.  Equivalent to invoking cstow
|           to install and deinstall in sequence.
|   -t DIR, Set the target directory to DIR.  If not
|           specified the parent directory will be used.
|   -v,     Be verbose, showing each operation performed.
```

## Stowing packages

The first non flag argument to `cstow` will be interpreted as a
package name. By default, `cstow` will look for the package in the
current directory, and will install it in the parent directory.

```sh
$ cd packages && cstow pkg
$ [ -d d0 ]
$ [ -d d0/d1 ]
$ [ -L d0/f0 ]
$ [ -L d0/d1/f1 ]
$ rm -rf d0
```

If no package exists with the given name, cstow will fail.

```sh
$ cstow xyz
@ cstow: Couldn't read dir '$(pwd)/xyz': No such file or directory
? 1
```

If more flexibility is needed, the `-d` flag allows you to choose
where packages will be looked up:

```sh
$ cstow -d packages pkg
$ [ -d d0 ]
$ rm -rf d0
```

In case more than a `-d` flag is supplied, the last one is used:

```sh
$ cstow -d foo -d packages pkg
$ [ -d d0 ]
$ rm -rf d0
```

You can also change the place where packages will be installed with
the `-t` flag:

```sh
$ mkdir target
$ cstow -d packages -t target pkg
$ [ -d target/d0 ]
$ rm -rf target
```

As with the `-d` flag, if more than one is provided, the last one is used:

```sh
$ mkdir target
$ cstow -d packages -t foo -t target pkg
$ [ -d target/d0 ]
$ rm -rf foo
```

## Unstowing packages

To unstow (uninstall) a package, use the `-D` flag:

```sh
$ cstow -d packages pkg
$ [ -d d0 ]
$ cstow -d packages -D pkg
$ [ ! -d d0 ]
```<commit_msg>Remove target directory<commit_after># CSTOW tests

This file contains all tests for _cstow_. To run it, execute `make
test` in this or the parent directory. If everything goes well, no
output should be produced.

In the tests, I assume a sample `pkg` package exists:

```sh
$ mkdir -p packages/pkg/d0/d1
$ touch packages/pkg/d0/f0
$ touch packages/pkg/d0/d1/f1
```

## Executing CSTOW with no arguments

CStow expects at least a non-flag argument, the package to
install. Executing `cstow` with no arguments will fail with a non-zero
exit status and will show a brief usage message.

```sh
$ cstow
@ Usage: cstow [-cdDhnRtv] <package-name>
@   -c,     Do not exit when a conflict is found, continue as if
@           nothing happened.  This options implies -n.
@   -d DIR, Set the package directory to DIR.  If not
@           specified the current directory will be used.
@   -D,     Delete the package instead of installing it.
@   -h,     Show this help message.
@   -n,     Do not perform any of the operations, only pretend.
@           Useful for detecting errors without damaging anything.
@   -R,     Reinstall a package.  Equivalent to invoking cstow
@           to install and deinstall in sequence.
@   -t DIR, Set the target directory to DIR.  If not
@           specified the parent directory will be used.
@   -v,     Be verbose, showing each operation performed.
? 1
```

## Getting help

When given the `-h` flag, `cstow` will show a usage message and exit
with a success status (0).

```sh
$ cstow -h
| Usage: cstow [-cdDhnRtv] <package-name>
|   -c,     Do not exit when a conflict is found, continue as if
|           nothing happened.  This options implies -n.
|   -d DIR, Set the package directory to DIR.  If not
|           specified the current directory will be used.
|   -D,     Delete the package instead of installing it.
|   -h,     Show this help message.
|   -n,     Do not perform any of the operations, only pretend.
|           Useful for detecting errors without damaging anything.
|   -R,     Reinstall a package.  Equivalent to invoking cstow
|           to install and deinstall in sequence.
|   -t DIR, Set the target directory to DIR.  If not
|           specified the parent directory will be used.
|   -v,     Be verbose, showing each operation performed.
```

## Stowing packages

The first non flag argument to `cstow` will be interpreted as a
package name. By default, `cstow` will look for the package in the
current directory, and will install it in the parent directory.

```sh
$ cd packages && cstow pkg
$ [ -d d0 ]
$ [ -d d0/d1 ]
$ [ -L d0/f0 ]
$ [ -L d0/d1/f1 ]
$ rm -rf d0
```

If no package exists with the given name, cstow will fail.

```sh
$ cstow xyz
@ cstow: Couldn't read dir '$(pwd)/xyz': No such file or directory
? 1
```

If more flexibility is needed, the `-d` flag allows you to choose
where packages will be looked up:

```sh
$ cstow -d packages pkg
$ [ -d d0 ]
$ rm -rf d0
```

In case more than a `-d` flag is supplied, the last one is used:

```sh
$ cstow -d foo -d packages pkg
$ [ -d d0 ]
$ rm -rf d0
```

You can also change the place where packages will be installed with
the `-t` flag:

```sh
$ mkdir target
$ cstow -d packages -t target pkg
$ [ -d target/d0 ]
$ rm -rf target
```

As with the `-d` flag, if more than one is provided, the last one is used:

```sh
$ mkdir target
$ cstow -d packages -t foo -t target pkg
$ [ -d target/d0 ]
$ rm -rf target
```

## Unstowing packages

To unstow (uninstall) a package, use the `-D` flag:

```sh
$ cstow -d packages pkg
$ [ -d d0 ]
$ cstow -d packages -D pkg
$ [ ! -d d0 ]
```
{'fraction_non_alphanumeric': 0.09834238751915308, 'fraction_numerical': 0.007521938988717091, 'mean_word_length': 2.733749349973999, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5139677', 'n_tokens_mistral': 2401, 'n_tokens_neox': 2312, 'n_words': 1084}