updated project documentation
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
---
|
||||
title: Installing Unique
|
||||
---
|
||||
|
||||
# Installing Unique
|
||||
|
||||
`unique` is meant to be used as a command-line tool, not as a project-local script that must be run
|
||||
from inside its source directory. For a developer workflow, the practical approach is:
|
||||
|
||||
1. Follow the instructions to [build from source](build-from-source.md), all the way to creating a
|
||||
standalone executable. This executable should be available under the `dist/` directory under the
|
||||
project root of `unique`.
|
||||
|
||||
2. Alternatively, download a pre-build copy of the executable for your operating system.
|
||||
|
||||
3. Copy the executable into a common location, so that you can delete the unique project folder at a
|
||||
later point in time.
|
||||
|
||||
4. Install the executable for global CLI access. You can use a command from within `unique` to
|
||||
complete the installation.
|
||||
|
||||
```sh
|
||||
cd /{folder-where-you-copied-the-executable}
|
||||
./unique install
|
||||
```
|
||||
|
||||
This command creates a symlink at `~/.local/bin/unique` that points to the built executable. After
|
||||
that, the tool can be invoked from anywhere in your shell:
|
||||
|
||||
```sh
|
||||
unique --help
|
||||
```
|
||||
|
||||
**Note:**
|
||||
|
||||
If `~/.local/bin` is not already on your `PATH`, add it:
|
||||
|
||||
```sh
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
```
|
||||
|
||||
For persistence, add the same line to your shell profile, such as `~/.bashrc` or `~/.zshrc`, then
|
||||
reload the shell.
|
||||
@@ -0,0 +1,150 @@
|
||||
---
|
||||
title: Suffix Methods
|
||||
---
|
||||
|
||||
# Suffix methods
|
||||
|
||||
`unique` works by appending a generated suffix to the original file or directory name. The suffix is
|
||||
what makes the resulting name safe for repeated or automated use without collisions.
|
||||
|
||||
The exact suffix format depends on the method you choose. This lets you balance readability,
|
||||
traceability, and compactness depending on the workload. The suffix method is selected per command
|
||||
and can be changed to suit the naming requirements of the particular workflow.
|
||||
|
||||
If you do not pass `--method`, the default is `datetime`.
|
||||
|
||||
## Default behavior
|
||||
|
||||
```bash
|
||||
unique create --file notes.txt
|
||||
```
|
||||
|
||||
This uses the `datetime` strategy by default and produces a name shaped like:
|
||||
|
||||
```text
|
||||
notes-20260917-100923.txt
|
||||
```
|
||||
|
||||
## Available methods
|
||||
|
||||
### datetime
|
||||
|
||||
Use this when you want a human-readable timestamp and do not need a UUID-like identifier.
|
||||
|
||||
```bash
|
||||
unique create --file draft.txt --method datetime
|
||||
unique create --dir build-output --method datetime
|
||||
unique touch report.md --method datetime
|
||||
unique duplicate archive.tar.gz --method datetime
|
||||
```
|
||||
|
||||
Example result:
|
||||
|
||||
```text
|
||||
draft-20260917-100923.txt
|
||||
```
|
||||
|
||||
This method encodes the current date and time using the `YYYYMMdd-HHmmss` pattern. It is easy to
|
||||
scan in logs and file listings, and it is the most readable option for regular local workflows.
|
||||
|
||||
### epoch
|
||||
|
||||
Use this when you want a numeric timestamp that is compact and easy to sort.
|
||||
|
||||
```bash
|
||||
unique create --file draft.txt --method epoch
|
||||
```
|
||||
|
||||
Example result:
|
||||
|
||||
```text
|
||||
draft-1789667326956.txt
|
||||
```
|
||||
|
||||
This method uses the number of milliseconds since the Unix epoch. It is useful when a numeric suffix
|
||||
is preferred for scripting, ordering, or easy correlation with timestamps in logs or automation.
|
||||
|
||||
### uuid
|
||||
|
||||
Use this when you need a strong, general-purpose unique identifier without caring about readability.
|
||||
|
||||
```bash
|
||||
unique create --file draft.txt --method uuid
|
||||
```
|
||||
|
||||
Example result:
|
||||
|
||||
```text
|
||||
draft-f5bc2a13-6efa-43d1-b969-88e5ee3d67fa.txt
|
||||
```
|
||||
|
||||
This method creates a UUID v4 value and appends its canonical string form. It is a good choice when
|
||||
uniqueness is the primary concern and the suffix does not need to be compact or human-friendly.
|
||||
|
||||
### uuid7
|
||||
|
||||
Use this when you want a UUID-based suffix that is both modern and sortable.
|
||||
|
||||
```bash
|
||||
unique create --file draft.txt --method uuid7
|
||||
```
|
||||
|
||||
Example result:
|
||||
|
||||
```text
|
||||
draft-01a0b081-ceae-719a-8af8-4f298e64d896.txt
|
||||
```
|
||||
|
||||
UUID v7 incorporates time ordering, which helps when you want a unique name that also carries a rough
|
||||
chronological signal. This is often a good fit for generated artifacts, logs, and content pipelines.
|
||||
|
||||
### uuid-b36
|
||||
|
||||
Use this when you want a shorter, more compact UUID-style suffix that still preserves uniqueness.
|
||||
|
||||
```bash
|
||||
unique create --file draft.txt --method uuid-b36
|
||||
```
|
||||
|
||||
Example result:
|
||||
|
||||
```text
|
||||
draft-pg3oglhnrjcl-2f6i06345p9xi.txt
|
||||
```
|
||||
|
||||
This method starts from a UUID v4 value, splits it into 64-bit halves, and encodes the result in
|
||||
base 36. The goal is shorter, more readable identifiers while retaining strong uniqueness.
|
||||
|
||||
### `uuid7-b36`
|
||||
|
||||
Use this when you want the same compactness as `uuid-b36` but with the sortability advantages of UUID v7.
|
||||
|
||||
```bash
|
||||
unique create --file draft.txt --method uuid7-b36
|
||||
```
|
||||
|
||||
Example result:
|
||||
|
||||
```text
|
||||
draft-w2v0gvd69av-2g3zdzsjfpjmd.txt
|
||||
```
|
||||
|
||||
This is the compact, base-36 form of UUID v7. It is a strong option for generated asset names where
|
||||
you want a short suffix without losing the time-oriented behavior of UUID v7.
|
||||
|
||||
## Choosing a method
|
||||
|
||||
A practical rule of thumb:
|
||||
|
||||
- `datetime`: best for human-readable output and quick inspection
|
||||
- `epoch`: best for scripts and sortable numeric timestamps
|
||||
- `uuid`: best for strong uniqueness with no readability concerns
|
||||
- `uuid7`: best for modern UUID-based generation with chronological ordering
|
||||
- `uuid-b36`: best when you want a shorter UUID-like suffix
|
||||
- `uuid7-b36`: best when you want compactness plus UUID v7 semantics
|
||||
|
||||
## Notes
|
||||
|
||||
`unique` does not promise a cryptographically special naming scheme for all methods; it is designed to
|
||||
make collisions extremely unlikely in normal developer and automation workflows. The main tradeoff is
|
||||
between readability and compactness, which is why several suffix strategies are exposed in the CLI.
|
||||
+3
-3
@@ -26,7 +26,7 @@ options:
|
||||
-h, --help show this help message and exit
|
||||
```
|
||||
|
||||
## Command: create
|
||||
## create
|
||||
|
||||
```sh
|
||||
$ ./unique create -h
|
||||
@@ -50,7 +50,7 @@ options:
|
||||
Default is 'datetime'.
|
||||
```
|
||||
|
||||
## Command: touch
|
||||
## touch
|
||||
|
||||
```sh
|
||||
$ ./unique touch -h
|
||||
@@ -72,7 +72,7 @@ options:
|
||||
Default is 'datetime'.
|
||||
```
|
||||
|
||||
## Command: duplicate
|
||||
## duplicate
|
||||
|
||||
```sh
|
||||
$ ./unique duplicate -h
|
||||
|
||||
Reference in New Issue
Block a user