updated project documentation
This commit is contained in:
@@ -21,182 +21,57 @@ and content authoring workflows. `unique` gives you a simple interface to:
|
||||
- Create files or directories with unique names
|
||||
- Rename existing files or folders safely
|
||||
- Duplicate files with a unique derivative name
|
||||
- Multiple suffix strategies:
|
||||
- `datetime`
|
||||
- `epoch`
|
||||
- `uuid`
|
||||
- `uuid7`
|
||||
- `uuid-b36`
|
||||
- `uuid7-b36`
|
||||
- Multiple suffix strategies: `datetime`, `epoch`, `uuid`, `uuid7`, `uuid-b36`, and `uuid7-b36`
|
||||
- Python-based CLI design for simple automation and scripting
|
||||
|
||||
## Documentation
|
||||
|
||||
- [Build from Source](docs/build-from-source.md) — set up the project and produce a distributable build.
|
||||
- [Using unique](usage.md) — learn the CLI commands and examples.
|
||||
|
||||
## Installation
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Python 3
|
||||
- `pip`
|
||||
|
||||
### Set up a virtual environment
|
||||
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
### Install dependencies
|
||||
|
||||
```bash
|
||||
pip install "git+https://rprime.indroneel.co/termhole/scott.git"
|
||||
pip install uuid6
|
||||
```
|
||||
|
||||
### Install the project
|
||||
|
||||
```bash
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
You can then invoke the CLI as:
|
||||
|
||||
```bash
|
||||
unique --help
|
||||
```
|
||||
|
||||
## Usage
|
||||
## Quick Usage
|
||||
|
||||
The CLI is organized around a small set of commands.
|
||||
|
||||
### Create a unique file
|
||||
**Create a unique file**
|
||||
|
||||
```bash
|
||||
unique create --file notes.txt
|
||||
```
|
||||
|
||||
Example result:
|
||||
This creates a new file with a name like `notes-20260916-153425.txt`
|
||||
|
||||
```text
|
||||
notes-20260916-153425.txt
|
||||
```
|
||||
|
||||
### Create a unique directory
|
||||
**Create a unique directory**
|
||||
|
||||
```bash
|
||||
unique create --dir project
|
||||
```
|
||||
|
||||
Example result:
|
||||
This creates a new folder with a name like `project-20260916-153425`
|
||||
|
||||
```text
|
||||
project-20260916-153425
|
||||
```
|
||||
|
||||
### Rename an existing file or directory
|
||||
**Rename an existing file or directory**
|
||||
|
||||
```bash
|
||||
unique touch report.md
|
||||
```
|
||||
|
||||
This appends a generated suffix to the original path instead of overwriting an existing file.
|
||||
`report.md` must pre-exist. This appends a generated suffix to the original path instead of
|
||||
overwriting an existing file.
|
||||
|
||||
### Duplicate a file with a unique name
|
||||
|
||||
```bash
|
||||
unique duplicate ./archive.tar.gz
|
||||
unique duplicate archive.tar.gz
|
||||
```
|
||||
`archive.tar.gz` must pre-exist. A copy of the file will be created with a name like
|
||||
`archive-20260916-153425.tar.gz`
|
||||
|
||||
Example result:
|
||||
|
||||
```text
|
||||
archive-20260916-153425.tar.gz
|
||||
```
|
||||
## Documentation
|
||||
|
||||
## Suffix methods
|
||||
|
||||
You can control the suffix algorithm with the `--method` option:
|
||||
|
||||
```bash
|
||||
unique create --file draft.txt --method uuid7
|
||||
```
|
||||
|
||||
Available methods:
|
||||
|
||||
- `datetime` — current date and time
|
||||
- `epoch` — Unix timestamp in milliseconds
|
||||
- `uuid` — UUID v4
|
||||
- `uuid7` — UUID v7
|
||||
- `uuid-b36` — base36 UUID representation
|
||||
- `uuid7-b36` — base36 UUID v7 representation
|
||||
|
||||
## Command reference
|
||||
|
||||
### `unique create`
|
||||
|
||||
Create a file or directory with a unique name.
|
||||
|
||||
```bash
|
||||
unique create PATH --file|--dir [--method METHOD]
|
||||
```
|
||||
|
||||
### `unique touch`
|
||||
|
||||
Rename an existing file or directory to a unique variant.
|
||||
|
||||
```bash
|
||||
unique touch PATH [--method METHOD]
|
||||
```
|
||||
|
||||
### `unique duplicate`
|
||||
|
||||
Create a copy of an existing file with a unique name.
|
||||
|
||||
```bash
|
||||
unique duplicate PATH [--method METHOD]
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```bash
|
||||
# Create a unique file using a UUID v7 suffix
|
||||
unique create --file draft.md --method uuid7
|
||||
|
||||
# Create a unique directory using the current timestamp
|
||||
unique create --dir content --method datetime
|
||||
|
||||
# Rename an existing file to a unique version
|
||||
unique touch ./notes.txt --method epoch
|
||||
|
||||
# Duplicate a file without clobbering the original
|
||||
unique duplicate ./backup.db --method uuid-b36
|
||||
```
|
||||
|
||||
## Project layout
|
||||
|
||||
```text
|
||||
unique/
|
||||
├── LICENSE
|
||||
├── README.md
|
||||
├── pyproject.toml
|
||||
├── unique.spec
|
||||
├── src/
|
||||
│ └── unique/
|
||||
│ ├── commands/
|
||||
│ ├── lib/
|
||||
│ └── main.py
|
||||
└── .venv/
|
||||
```
|
||||
- [Build from Source](docs/build-from-source.md) — set up the project and produce a distributable
|
||||
build.
|
||||
- [Installation](docs/installation.md) — install the CLI tool and make it available from any
|
||||
directory.
|
||||
- [Using unique](docs/usage.md) — learn the CLI commands and examples for more detailed usage.
|
||||
- [Suffix methods](docs/suffix-methods.md) - the different strategies to generate a unique name.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the terms of the repository license. See [LICENSE](LICENSE) for details.
|
||||
|
||||
## Notes
|
||||
|
||||
This project is intentionally compact and script-friendly: it focuses on one task well—creating unique names for paths—while leaving room for automation in shell scripts, build tooling, and content workflows.
|
||||
|
||||
If you want to package it into a standalone executable, the repository includes a PyInstaller spec file at [unique.spec](unique.spec).
|
||||
This project is distributed under the
|
||||
[DuxTechnica Limited Use Source Code License Agreement](LICENSE).
|
||||
Reference in New Issue
Block a user