Skip to content

Conversation

@Jython1415
Copy link
Owner

Summary

This PR refactors the clipboard tooling in the dotfiles repository into a cleaner, more maintainable architecture with a unified clip dispatcher and better separation of concerns.

Key Changes

New Architecture:

  • ✅ Created lib/ directory for internal utilities (not in PATH)
  • ✅ New clip dispatcher script with unified interface for all clipboard operations
  • ✅ Renamed tagwrapwrap (general-purpose, works standalone or via clip)
  • ✅ Moved html-clipboard to lib/ (internal helper)
  • ✅ Deleted markdownify-clipboard and normalize-clipboard (replaced by clip subcommands)
  • ✅ Updated .zshrc to remove obsolete functions (copyxlsx, copycsv, cliptagwrap)

New clip Dispatcher Subcommands:

clip get/set/copy/paste      # Basic clipboard operations
clip markdownify             # HTML → Markdown (macOS only)
clip normalize               # HTML cleanup (macOS only)
clip import csv/xlsx         # Import data files to clipboard
clip wrap TAG [args]         # Wrap clipboard in XML tags
clip merge [args]            # Merge Alfred clipboard history

Platform Support:

  • macOS: Full support (pbcopy/pbpaste + HTML operations)
  • Linux (Wayland): wl-copy/wl-paste (HTML support deferred)
  • Linux (X11): xclip (HTML support deferred)

Benefits:

  • Unified interface via clip command
  • Clear separation: bin/ in PATH, lib/ for internals
  • Per-subcommand dependency checking with helpful errors
  • General-purpose tools (wrap, csvcat, xlcat) remain usable independently
  • Better error messages and platform detection

Repository Structure

~/.dotfiles/
├── bin/                    # In PATH via .zshrc
│   ├── clip               # New dispatcher (routes to subcommands)
│   ├── wrap               # Renamed from tagwrap (general-purpose)
│   ├── clipmerge          # Keep as-is
│   ├── csvcat             # Keep as-is
│   ├── xlcat              # Keep as-is
│   └── ...
├── lib/                   # Internal utilities (NOT in PATH)
│   └── html-clipboard     # Moved from bin/
└── .zshrc                 # Cleaned up (removed obsolete functions)

Migration Guide

Old → New:

# Clipboard operations
copyxlsx              → clip import xlsx
copycsv               → clip import csv
cliptagwrap TAG       → clip wrap TAG
markdownify-clipboard → clip markdownify
normalize-clipboard   → clip normalize

# Standalone tools still work
tagwrap TAG           → wrap TAG

Testing

  • ✅ Tested clip help (works without clipboard utilities)
  • ✅ Tested wrap standalone functionality
  • ✅ Tested wrap with attributes
  • ✅ Verified file structure (lib/, bin/)
  • ✅ Verified git changes (renames, deletions, new files)

Files Changed

  • bin/clip - New unified dispatcher
  • bin/wrap - Renamed from tagwrap, updated docs
  • lib/html-clipboard - Moved from bin/
  • .zshrc - Removed obsolete functions
  • Deleted: bin/markdownify-clipboard, bin/normalize-clipboard

Resolves #5

Major changes:
- Create lib/ directory for internal utilities
- Move html-clipboard to lib/ (not in PATH)
- Rename tagwrap to wrap (general-purpose tool)
- Add clip dispatcher with subcommands:
  - get/set/copy/paste for basic operations
  - markdownify/normalize for HTML conversion
  - import csv/xlsx for data import
  - wrap for tag wrapping
  - merge for Alfred history
- Delete obsolete scripts (markdownify-clipboard, normalize-clipboard)
- Remove obsolete .zshrc functions (copyxlsx, copycsv, cliptagwrap)
- Add platform detection (macOS, Wayland, X11)
- Add per-subcommand dependency checking

This creates a cleaner architecture with:
- Unified interface via clip dispatcher
- Specialized tools callable independently
- Internal helpers in lib/ directory
- Better error messages and platform support

Resolves #5
Copy link
Owner Author

@Jython1415 Jython1415 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@Jython1415 Jython1415 merged commit 3329bb4 into main Jan 17, 2026
1 check passed
@Jython1415 Jython1415 deleted the claude/setup-dotfiles-scripts-YHZxn branch January 17, 2026 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consolidate custom clipboard-related scripts and commands

3 participants