@@ -96,20 +96,56 @@ cmake --build build --target coverage
9696
9797## CLI Usage
9898
99+ ### Global Options
100+
101+ All commands support these global options:
102+
103+ ``` bash
104+ -v, --verbose Enable verbose output showing detailed operations
105+ -q, --quiet Suppress non-error output (only show errors)
106+ -h, --help Show help message for the command
107+ --version Show version information
108+ ```
109+
99110### Creating containers
100111
112+ The ` create ` command builds new BFC containers from files and directories.
113+
114+ ** Syntax:** ` bfc create [options] <container.bfc> <input-paths...> `
115+
116+ ** Options:**
117+ - ` -b, --block-size SIZE ` - Set container block size (default: 4096 bytes)
118+ - ` -f, --force ` - Overwrite existing container file
119+ - ` -c, --compression TYPE ` - Compression: ` none ` , ` zstd ` , ` auto ` (default: none)
120+ - ` -l, --compression-level N ` - Compression level for ZSTD (1-22, default: 3)
121+ - ` -t, --compression-threshold SIZE ` - Minimum file size to compress (default: 64 bytes)
122+ - ` -e, --encrypt PASSWORD ` - Encrypt files with password (requires libsodium)
123+ - ` -k, --keyfile FILE ` - Encrypt with 32-byte key from file (requires libsodium)
124+
125+ ** Examples:**
101126``` bash
102127# Create from directory
103128bfc create documents.bfc ~ /Documents/
104129
105- # Create from multiple sources
130+ # Create from multiple sources
106131bfc create backup.bfc file1.txt file2.txt ~ /Pictures/ ~ /Music/
107132
108- # Custom block size (default: 4096 )
133+ # Custom block size (for performance tuning )
109134bfc create -b 8192 archive.bfc /data/
110135
111136# Force overwrite existing container
112137bfc create -f archive.bfc /path/to/files/
138+
139+ # Create with compression
140+ bfc create -c zstd archive.bfc /data/
141+ bfc create -c zstd -l 9 archive.bfc /data/ # Maximum compression
142+
143+ # Create with encryption
144+ bfc create -e mypassword secure.bfc /sensitive/data/
145+ bfc create -k secret.key secure.bfc /sensitive/data/
146+
147+ # Combined compression and encryption
148+ bfc create -c zstd -e secret -l 6 archive.bfc /data/
113149```
114150
115151### Compression support
@@ -193,62 +229,118 @@ bfc info secure.bfc path/to/file.txt
193229
194230### Listing contents
195231
232+ The ` list ` command displays container contents with various formatting options.
233+
234+ ** Syntax:** ` bfc list [options] <container.bfc> [path] `
235+
236+ ** Options:**
237+ - ` -l, --long ` - Use long listing format (like ` ls -l ` ) showing permissions, size, date
238+ - ` -s, --size ` - Show file sizes in human-readable format
239+ - ` -c, --checksum ` - Show CRC32C checksums for integrity verification
240+ - Combine options: ` -sc ` shows both sizes and checksums
241+
242+ ** Examples:**
196243``` bash
197- # Simple listing
244+ # Simple listing (names only)
198245bfc list archive.bfc
199246
200- # Long format (like ls -l)
247+ # Long format with permissions, size, and timestamps
201248bfc list -l archive.bfc
202249
203250# Show file sizes and checksums
204251bfc list -sc archive.bfc
205252
206- # Filter by path prefix
253+ # Filter by path prefix or directory
207254bfc list archive.bfc docs/
255+ bfc list archive.bfc docs/readme.txt
256+
257+ # Combined: long format with sizes and checksums
258+ bfc list -lsc archive.bfc
208259```
209260
210261### Extracting files
211262
263+ The ` extract ` command extracts files and directories from containers.
264+
265+ ** Syntax:** ` bfc extract [options] <container.bfc> [paths...] `
266+
267+ ** Options:**
268+ - ` -C, --directory DIR ` - Extract to specific directory (changes to DIR before extracting)
269+ - ` -f, --force ` - Overwrite existing files without prompting
270+ - ` -k, --keep-paths ` - Preserve full directory structure (default: flatten to basenames)
271+ - ` -p, --password PASS ` - Provide password for encrypted containers
272+ - ` -K, --keyfile FILE ` - Use key file for encrypted containers (32 bytes)
273+
274+ ** Examples:**
212275``` bash
213- # Extract all files to current directory
276+ # Extract all files to current directory (flattened)
214277bfc extract archive.bfc
215278
216279# Extract to specific directory
217- bfc extract -C /tmp archive.bfc
280+ bfc extract -C /tmp/extracted archive.bfc
218281
219- # Extract specific files/directories
220- bfc extract archive.bfc docs/ README.txt
221-
222- # Preserve full directory paths
282+ # Extract preserving directory structure
223283bfc extract -k archive.bfc
224284
285+ # Extract specific files/directories only
286+ bfc extract archive.bfc docs/ README.txt
287+
225288# Force overwrite existing files
226289bfc extract -f archive.bfc
290+
291+ # Extract encrypted container with password
292+ bfc extract -p mypassword secure.bfc
293+
294+ # Extract encrypted container with key file
295+ bfc extract -K secret.key secure.bfc
296+
297+ # Combined: extract to directory, preserve paths, force overwrite
298+ bfc extract -kf -C /tmp/output archive.bfc
227299```
228300
229301### Container information
230302
303+ The ` info ` command displays detailed information about containers and individual files.
304+
305+ ** Syntax:** ` bfc info [options] <container.bfc> [path] `
306+
307+ ** Options:**
308+ - ` -d, --detailed ` - Show detailed information including compression ratios, encryption status
309+
310+ ** Examples:**
231311``` bash
232- # Basic container info
312+ # Basic container summary
233313bfc info archive.bfc
234314
235- # Detailed listing with metadata
315+ # Detailed container information
236316bfc info -d archive.bfc
237317
238318# Information about specific file
239319bfc info archive.bfc path/to/file.txt
320+
321+ # Detailed info about specific file (shows compression, encryption)
322+ bfc info -d archive.bfc path/to/file.txt
240323```
241324
242325### Verifying integrity
243326
327+ The ` verify ` command checks container and file integrity.
328+
329+ ** Syntax:** ` bfc verify [options] <container.bfc> `
330+
331+ ** Options:**
332+ - ` --deep ` - Perform deep verification (read and verify all file contents, slower but thorough)
333+ - ` -p, --progress ` - Show progress bar during verification (useful for large containers)
334+
335+ ** Examples:**
244336``` bash
245- # Quick structural verification
337+ # Quick structural verification (fast)
246338bfc verify archive.bfc
247339
248- # Deep verification (check all file contents)
340+ # Deep verification checking all file contents (slower but complete )
249341bfc verify --deep archive.bfc
250342
251- # Show progress for large containers
343+ # Deep verification with progress indicator
252344bfc verify -p --deep archive.bfc
253345```
254346
@@ -307,6 +399,87 @@ bfc_close_read(reader);
307399
308400See the [examples/](examples/) directory for complete examples.
309401
402+ ## CLI Reference
403+
404+ ### Quick Reference
405+
406+ **Global Options** (available for all commands):
407+ ```
408+ -v, --verbose Enable verbose output
409+ -q, --quiet Suppress non-error output
410+ -h, --help Show help message
411+ --version Show version information
412+ ```
413+
414+ **Commands Summary:**
415+
416+ | Command | Purpose | Key Options |
417+ |---------|---------|-------------|
418+ | `create` | Build new container | `-c` (compression), `-e` (encrypt), `-f` (force) |
419+ | `list` | Show contents | `-l` (long format), `-s` (sizes), `-c` (checksums) |
420+ | `extract` | Extract files | `-C` (directory), `-k` (keep paths), `-p` (password) |
421+ | `info` | Container info | `-d` (detailed) |
422+ | `verify` | Check integrity | `--deep` (full check), `-p` (progress) |
423+
424+ ### Complete Option Reference
425+
426+ **`bfc create [options] <container.bfc> <input-paths...>`**
427+ ```
428+ -b, --block-size SIZE Block size (default: 4096)
429+ -f, --force Overwrite existing container
430+ -c, --compression TYPE none|zstd|auto (default: none)
431+ -l, --compression-level N ZSTD level 1-22 (default: 3)
432+ -t, --compression-threshold SIZE Min size to compress (default: 64)
433+ -e, --encrypt PASSWORD Encrypt with password
434+ -k, --keyfile FILE Encrypt with key file (32 bytes)
435+ ```
436+
437+ **`bfc list [options] <container.bfc> [path]`**
438+ ```
439+ -l, --long Long format (permissions, size, date)
440+ -s, --size Show file sizes
441+ -c, --checksum Show CRC32C checksums
442+ ```
443+
444+ **`bfc extract [options] <container.bfc> [paths...]`**
445+ ```
446+ -C, --directory DIR Extract to specific directory
447+ -f, --force Overwrite existing files
448+ -k, --keep-paths Preserve directory structure
449+ -p, --password PASS Password for encrypted containers
450+ -K, --keyfile FILE Key file for encrypted containers
451+ ```
452+
453+ **`bfc info [options] <container.bfc> [path]`**
454+ ```
455+ -d, --detailed Show detailed information
456+ ```
457+
458+ **`bfc verify [options] <container.bfc>`**
459+ ```
460+ --deep Deep verification (check all content)
461+ -p, --progress Show progress indicator
462+ ```
463+
464+ ### Common Usage Patterns
465+
466+ ```bash
467+ # Create compressed encrypted archive
468+ bfc create -c zstd -e password archive.bfc /data/
469+
470+ # List with full details
471+ bfc list -lsc archive.bfc
472+
473+ # Extract preserving structure to specific location
474+ bfc extract -k -C /tmp/restored archive.bfc
475+
476+ # Verify with progress
477+ bfc verify -p --deep archive.bfc
478+
479+ # Get detailed info about specific file
480+ bfc info -d archive.bfc path/to/file.txt
481+ ```
482+
310483## File Format
311484
312485BFC uses a simple, efficient binary format:
0 commit comments