Metadata-Version: 2.4
Name: tuxfan-finder
Version: 0.1.0
Summary: Preview and apply macOS Finder folder views recursively
Project-URL: Repository, https://github.com/tuxfan/finder
Classifier: Environment :: Console
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: ds-store==1.3.1

# tuxfan-finder

`tuxfan-finder` is a macOS command-line tool that previews and applies folder view settings recursively. It updates existing Finder `.DS_Store` files.

## Install

On macOS with Python 3.9 or later, install the published package in a virtual environment.

```bash
python3 -m venv --prompt finder ~/.venv/finder
source ~/.venv/finder/bin/activate
python -m pip install tuxfan-finder
```

From a checkout, run `python -m pip install .` inside the environment.

## Local builds with CMake

With CMake 3.24 or later and Python 3.9 or later, run these commands from the repository root:

```bash
cmake -S . -B .cmake-build
cmake --build .cmake-build
source .venv/bin/activate
finder --help
```

The default build creates or reuses the repository's `.venv` and installs the package in editable mode. Set `-DFINDER_VENV_DIR=/path/to/venv` at configure time to use another environment, or `-DPython3_EXECUTABLE=/path/to/python3` to choose the interpreter used to create it.

Run a target with `cmake --build .cmake-build --target <target>`.

| Target | Purpose |
| --- | --- |
| `venv` | Create the virtual environment with the `finder` prompt if needed. |
| `install-editable` | Install the checkout in editable mode and configure shell completion. This is the default build. |
| `update-deps` | Install or upgrade the Python build and validation tools. |
| `pip-check` | Check the installed package's dependencies. |
| `verify` | Check dependencies and smoke-test both Finder subcommands. |
| `package` | Build the wheel and source distribution under `.cmake-build/dist/<version>/`. Run `update-deps` first. |
| `dist-check` | Validate the existing artifacts with Twine after running `package`. |
| `clean-all` | Remove the project-local virtual environment, distributions, and generated Python files while keeping the CMake configuration and external virtual environments. |

## Use

```bash
finder test-view ~/Documents --view list --alphabetical
finder set-view ~/Documents --view list --alphabetical
finder set-view ~/Desktop --view icon
```

- `test-view` previews changes without writing files or relaunching Finder.
- `set-view` applies changes and saves the first original of each changed store as `.DS_Store.finder-view.bak`.
- `--view` accepts `list` (the default), `icon`, `column`, and `gallery`.
- `--alphabetical` sets Name (A–Z) and disables grouping in List view.
- `--no-include-parent` skips the target folder's record in its parent's existing store.
- `--no-relaunch-finder` keeps Finder running while `set-view` writes. By default, `set-view` quits Finder before writing and reopens it afterward to clear its cache. This can close Finder windows, and macOS may ask for permission to control Finder.

The tool skips paths with insufficient permissions. Finder preferences such as **Keep folders on top** can affect the displayed order across Finder windows. Run `finder --help` or `finder set-view --help` for command details.

### Shell completion

`finder completion bash`, `finder completion zsh`, and `finder completion fish` print scripts for those shells. Running `finder completion` prints the Bash script. To enable Bash completion in the current session, run:

```bash
source <(finder completion bash)
```

To load completion automatically whenever you activate the virtual environment where Finder is installed, run `finder completion install` and reactivate the environment. The installer updates `bin/activate` and `bin/activate.fish` when present and backs up the originals. The default CMake build runs this step automatically.

Completion suggests subcommands, directory paths, options, and values for `--view`. It also supports the `finder-set-view` command.

## Release to PyPI

Commit the release changes and their user-facing bullets in [UNRELEASED.md](UNRELEASED.md) before starting. The full release target requires a clean branch checkout and a configured Git identity.

```bash
cmake -S . -B .cmake-build
cmake --build .cmake-build --target release
```

This checks PyPI for the published version, finalizes [NEWS.md](NEWS.md), verifies the CLI, commits the release metadata, and creates an annotated local `vVERSION` tag. It builds the wheel and source distribution from that tag into `.cmake-build/dist/<version>/`, then verifies and uploads them with Twine. Push the Git commit and tag separately. When using a PyPI API token, supply `__token__` as the Twine username and the token as the password.

To review the notes and artifacts before publishing, run the stages separately:

```bash
cmake --build .cmake-build --target release-preflight
cmake --build .cmake-build --target update-deps
cmake --build .cmake-build --target prepare-release
git diff -- NEWS.md UNRELEASED.md pyproject.toml
cmake --build .cmake-build --target tag-release
cmake --build .cmake-build --target package-release
cmake --build .cmake-build --target dist-check
# Review the wheel, source distribution, and release.json before uploading.
cmake --build .cmake-build --target upload-pypi
```

`prepare-release` keeps the local version if it is newer than PyPI's version or if this is the first release. Otherwise it selects the next patch version. Use `check-version` to compare versions, or `bump-version` to update just the version in `pyproject.toml`.

The release wheel and source archive include the finalized notes. `release.json` records the tag, commit, and SHA-256 hashes. Upload requires a clean checkout at the tag and the original, verified artifacts. If a build or upload fails after tagging, resume with `package-release` or `upload-pypi` as appropriate. Use `package` for development builds of the working tree.
