Skip to main content

A lightweight text file management system with multi-vault support

Project description

UniBinaryTextVault (TVault)

License: MIT Python Version Platform

A lightweight, command-line text file management system with multi-vault support and automatic backups.

Version: 2.1

Note: The project is actively maintained and improved.

โœจ New Features in 2.0

  • Multi-vault support: Manage multiple data directories (vaults)
  • Enhanced backup system: Timestamp-based backups with flexible recovery options
  • Modular architecture: Separate vault and file management modules
  • Advanced file operations: Rename, bulk backup deletion, and more
  • Zip import/export: Easily transfer vaults between systems

๐Ÿ“ฆ Installation

Method 1: Install from PyPI (Recommended)

pip3 install UniBinaryTextVault

Method 2: Install from source

git clone https://github.com/UniBinary/TextVault.git
cd TextVault
pip3 install .

๐Ÿš€ Quick Start

# Create a new vault
tvault vault add myvault ~/Documents/myvault

# Switch to the vault
tvault vault switch myvault

# Create a new file
tvault file create notes

# Write content to the file (opens nano editor)
tvault file update notes

# Read the file
tvault file read notes

# Create a backup
tvault file backup notes

# List all files
tvault file list

# Get help
tvault --help

๐Ÿ“– Usage

Note: There are some usage examples at the end of the document.

Vault Management

Command Description Example
tvault vault add <name> <path> Add a new vault tvault vault add work ~/work_vault
tvault vault remove <name> Remove vault from registry tvault vault remove work
tvault vault delete <name> Delete vault from disk and registry tvault vault delete work
tvault vault switch <name> Switch to a vault tvault vault switch work
tvault vault list List all vaults tvault vault list
tvault vault current Show current vault tvault vault current
tvault vault dump <name> <path> Export vault to zip tvault vault dump work backup.zip
tvault vault import <zip> <path> Import zip as vault tvault vault import backup.zip ~/new_vault

File Management

Command Description Example
tvault file create <file> Create a new file tvault file create notes
tvault file read <file> Read file content tvault file read notes
tvault file read <file> --backup <spec> Read from backup tvault file read notes --backup latest
tvault file update <file> Edit file with nano tvault file update notes
tvault file update <file> --backup Edit with backup tvault file update notes --backup
tvault file update <file> --vim Edit with vim tvault file update notes --vim
tvault file delete <file> Delete file tvault file delete notes
tvault file delete <file> --backup Delete all backups tvault file delete notes --backup
tvault file delete <file> --backup N Delete N oldest backups tvault file delete notes --backup 3
tvault file rename <old> <new> Rename file tvault file rename notes memos
tvault file backup <file> Create backup tvault file backup notes
tvault file recover <file> <spec> Recover from backup tvault file recover notes latest
tvault file list List all files tvault file list

Backup Specification

The --backup option accepts several formats:

  • latest: The most recent backup
  • N: The Nth backup (1 = newest, 2 = second newest, etc.)
  • YYYY_MM_DD: Backup from specific date
  • YYYY_MM_DD-hh:mm:ss: Backup from specific date and time

๐Ÿ—‚๏ธ Data Structure

Configuration Files

~/.local/lib/tvault/
โ”œโ”€โ”€ vaults.json          # Vault registry
โ””โ”€โ”€ current.txt          # Current vault info

Vault Structure

vault_directory/
โ”œโ”€โ”€ index.json           # File index with backup counts
โ”œโ”€โ”€ file1/
โ”‚   โ”œโ”€โ”€ file1            # Main file
โ”‚   โ”œโ”€โ”€ file1_20250207-124639.bak
โ”‚   โ””โ”€โ”€ file1_20250206-184937.bak
โ””โ”€โ”€ file2/
    โ”œโ”€โ”€ file2
    โ””โ”€โ”€ file2_20250107-014846.bak

File Formats

vaults.json:

{
  "default": "/Users/user/.local/lib/tvault/default",
  "work": "/Users/user/Documents/work_vault"
}

current.txt:

work
/Users/user/Documents/work_vault

index.json:

{
  "notes": 3,
  "memos": 1
}

๐Ÿ› ๏ธ Development

Project Structure

textvault/
โ”œโ”€โ”€ tvault/
โ”‚   โ”œโ”€โ”€ __init__.py      # Package initialization
โ”‚   โ”œโ”€โ”€ cli.py           # CLI interface
โ”‚   โ”œโ”€โ”€ vault.py         # Vault management
โ”‚   โ”œโ”€โ”€ file.py          # File management
โ”‚   โ””โ”€โ”€ __main__.py      # Main entry point
โ”œโ”€โ”€ setup.py             # Installation configuration
โ”œโ”€โ”€ README.md            # This file
โ””โ”€โ”€ LICENSE              # MIT License

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Reporting Issues

If you encounter any issues, please:

  1. Check the existing issues
  2. Create a new issue with:
    • A clear description of the problem
    • Steps to reproduce
    • Expected vs actual behavior
    • Your environment (OS, Python version)

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ“ž Contact

๐Ÿ™ Acknowledgments

  • Thanks to all contributors and users
  • Built with Python's standard library

๐Ÿ“ฆ Dependencies

TextVault requires the following Python packages:

  • pyotp>=2.6.0 (for potential future TOTP support)

These are automatically installed when using pip install UniBinaryTextVault.

UniBinaryTextVault (TVault) - Usage Examples

๐Ÿฆ Multi-Vault Management

1. Setting Up Multiple Vaults

# Create a personal vault
tvault vault add personal ~/Documents/personal_vault

# Create a work vault
tvault vault add work ~/Documents/work_vault

# Create a project vault
tvault vault add project ~/Projects/notes_vault

# List all vaults
tvault vault list
# Output:
# personal: /Users/user/Documents/personal_vault
# work: /Users/user/Documents/work_vault
# project: /Users/user/Projects/notes_vault

# Switch to work vault
tvault vault switch work

# Check current vault
tvault vault current
# Output:
# work: /Users/user/Documents/work_vault

2. Exporting and Importing Vaults

# Export work vault to zip file
tvault vault dump work ~/Desktop/work_backup.zip

# Import the backup as a new vault
tvault vault import ~/Desktop/work_backup.zip ~/Documents/work_archive

# The new vault will be automatically added
tvault vault list
# Output will include: work_archive: /Users/user/Documents/work_archive

๐Ÿ“ File Management

3. Basic File Operations

# Make sure you're in the right vault
tvault vault switch personal

# Create a new file
tvault file create daily_notes

# Edit the file (opens nano by default)
tvault file update daily_notes
# Add some content and save

# Read the file
tvault file read daily_notes

# Create a backup
tvault file backup daily_notes

# List all files in current vault
tvault file list
# Output:
# daily_notes: 1

4. Advanced Backup Operations

# Create multiple backups
tvault file backup daily_notes
tvault file backup daily_notes
tvault file backup daily_notes

# Check backup count
tvault file list
# Output: daily_notes: 3

# Read from specific backup
tvault file read daily_notes --backup latest
tvault file read daily_notes --backup 2  # Second newest backup
tvault file read daily_notes --backup 2025_02_07  # Backup from specific date

# Delete the oldest backup
tvault file delete daily_notes --backup 1

# Check updated backup count
tvault file list
# Output: daily_notes: 2

# Delete all backups
tvault file delete daily_notes --backup

# Check final backup count
tvault file list
# Output: daily_notes: 0

5. File Editing with Different Editors

# Edit with nano (default)
tvault file update config --backup  # Creates backup before editing

# Edit with vim
tvault file update script.py --vim

# Edit with vim and create backup
tvault file update important.txt --vim --backup

6. File Recovery

# Accidentally overwrote a file? Recover from backup!
tvault file recover important_doc latest

# Recover from specific backup
tvault file recover report 2025_02_06-14:30:00

7. File Organization

# Create multiple files
tvault file create meeting_notes
tvault file create todo_list
tvault file create ideas

# Rename a file
tvault file rename meeting_notes meeting_20250207

# Delete a file
tvault file delete old_notes

๐Ÿ”„ Workflow Examples

8. Daily Journal Workflow

# Switch to personal vault
tvault vault switch personal

# Create today's journal entry
tvault file create journal_$(date +%Y%m%d)

# Edit the journal
tvault file update journal_$(date +%Y%m%d) --backup

# At the end of the day, create a final backup
tvault file backup journal_$(date +%Y%m%d)

9. Project Documentation

# Switch to project vault
tvault vault switch project

# Create project documentation
tvault file create README
tvault file create API_DOCS
tvault file create CHANGELOG

# Work on API documentation
tvault file update API_DOCS --vim --backup

# After major changes, create backups
tvault file backup README
tvault file backup API_DOCS

10. Code Snippet Management

# Create files for different languages
tvault file create python_snippets
tvault file create javascript_snippets
tvault file create sql_queries

# Add a new Python snippet
tvault file update python_snippets
# Add: # Fibonacci function
# Add: def fibonacci(n):
# Add:     if n <= 1:
# Add:         return n
# Add:     return fibonacci(n-1) + fibonacci(n-2)

# Create backup before major reorganization
tvault file backup python_snippets

๐Ÿšจ Emergency Scenarios

11. Recovering from Accidental Deletion

# Oops! Deleted the wrong file
# First, check if you have backups
tvault file list
# If backup count > 0, you can recover

# Recover from latest backup
tvault file recover important_file latest

# If that doesn't work, try older backups
tvault file recover important_file 2
tvault file recover important_file 2025_02_06

12. Migrating to a New Computer

# On old computer: export all vaults
tvault vault dump personal ~/Desktop/personal_backup.zip
tvault vault dump work ~/Desktop/work_backup.zip

# On new computer: install TextVault
pip3 install UniBinaryTextVault

# Import vaults
tvault vault import ~/Desktop/personal_backup.zip ~/Documents/personal
tvault vault import ~/Desktop/work_backup.zip ~/Documents/work

# Switch to your preferred vault
tvault vault switch personal

๐Ÿ’ก Tips and Best Practices

  1. Regular Backups: Use --backup flag when editing important files
  2. Meaningful Names: Use descriptive file names
  3. Vault Organization: Separate personal, work, and project files
  4. Clean Up: Periodically delete old backups with tvault file delete <file> --backup N
  5. Export Regularly: Use tvault vault dump for important vaults

๐Ÿ› Troubleshooting

Common Issues and Solutions

Issue: "Error: No current vault selected" Solution: Use tvault vault switch <vault_name> to select a vault first

Issue: "Editor not found" Solution: Install nano or vim: sudo apt install nano (Linux) or brew install nano (macOS)

Issue: "File not found" Solution: Check current vault with tvault vault current and file list with tvault file list

Issue: "Invalid backup specification" Solution: Use one of: latest, N (number), YYYY_MM_DD, or YYYY_MM_DD-hh:mm:ss

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unibinarytextvault-2.1.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unibinarytextvault-2.1-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file unibinarytextvault-2.1.tar.gz.

File metadata

  • Download URL: unibinarytextvault-2.1.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for unibinarytextvault-2.1.tar.gz
Algorithm Hash digest
SHA256 43b64cac8e7655895b4ec34f1d532caef3438e7aafc65c4ece6889b25647f2f6
MD5 5feac036ada13aa8090b02b06e1c034c
BLAKE2b-256 3cbaad4a80ace3b3d51c2878b78de7f9aac799f82e57dde4247c6a78db310678

See more details on using hashes here.

File details

Details for the file unibinarytextvault-2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for unibinarytextvault-2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ad8467461c5ea9904e89e6612fafb49d44ffcb5a55b23c4c1241ca6b1c0d7daf
MD5 e1d381e501e8175c2d7f5484ef3b2fba
BLAKE2b-256 9e32fe836f0e5e7ba1975d8f202d2d89b431d6bedf7cc9aa50b680e295ac9cfa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page