Skip to main content

A utility for quickly copying a given string (template) to your clipboard

Project description

A Template to Clipboard Utility

Templates to your clipboard: because sometimes you just can't be bothered to type it again. While this utility was created as an exercise to relearn typer (which is great, though really all CLI tools should be "rewritten in Rust") and a few other tools (and whack this out as quickly as possible), but hopefully it's at least of some use to some folks. Eventually, the idea is to also leverage template strings once those become available, because really that is a great idea.

Installation

The recommended installation path is via the uv tool interface, installing via the GH link or PyPI, as you please:

uv tool install tmplcl
uv tool install git+https://github.com/delfanbaum/tmplcl

Usage

This package provides two executable commands: tmplcl and tcl. tmplcl is the "app" version of the tool, allowing you to perform all the expected CRUD tasks such as creating, listing, deleting, and updating your various templates. tcl is essentially just a shortcut for tmplcl copy TEMPLATE_ID, because who wants to do all that typing.

The usage for each is as follows:

tmplcl --help
                                                                              
 Usage: tmplcl [OPTIONS] COMMAND [ARGS]...                                    
                                                                              
╭─ Options ──────────────────────────────────────────────────────────────────╮
│ --install-completion          Install completion for the current shell.    │
│ --show-completion             Show completion for the current shell, to    │
│                               copy it or customize the installation.       │
│ --help                        Show this message and exit.                  │
╰────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ─────────────────────────────────────────────────────────────────╮
│ copy     Copies the requested template to your clipboard                   │
│ delete   Deletes the template with the provided identifier                 │
│ add      Adds a template with the provided identifier and string           │
│ list     Lists all available templates, including a preview of each        │
│ show     Displays the full text of a given template                        │
│ update   Updates a given template with a new string                        │
╰────────────────────────────────────────────────────────────────────────────╯
tcl --help
                                                                              
 Usage: tcl [OPTIONS] TEMPLATE                                                
                                                                              
 Finds a template by its id and copies the resultant string to the clipboard  
                                                                              
                                                                              
╭─ Arguments ────────────────────────────────────────────────────────────────╮
│ *    template      TEXT  [default: None] [required]                        │
╰────────────────────────────────────────────────────────────────────────────╯
╭─ Options ──────────────────────────────────────────────────────────────────╮
│ --help          Show this message and exit.                                │
╰────────────────────────────────────────────────────────────────────────────╯

Data Storage

Following the XDG Base Directory Specification, data will stored in $XDG_DATA_HOME/tmplcl.

If you would like to define your templates manually, it's all just JSON, so open up $XDG_DATA_HOME/tmplcl/data.json and have at it. The schema is roughly as follows:

{
  "description": "The model for the templates copied over to the clipboard. Contains the\ntemplate identifier as well as the template string.\n\nNote that the id may contain only alphanumeric characters or `-` and `_`",
  "properties": {
    "identifier": {
      "minLength": 1,
      "pattern": "^[a-zA-Z0-9_-]+$",
      "title": "Identifier",
      "type": "string"
    },
    "template": {
      "minLength": 1,
      "title": "Template",
      "type": "string"
    }
  },
  "required": [
    "identifier",
    "template"
  ],
  "title": "Template",
  "type": "object"
}

Development

To get started, run uv sync.

The Future

Eventually, the goal is to support these "templates" as actual... templates. Like, being able to run tcl my_template foo where my_template is "My favorite food is {} and "My favorite food is foo" gets put on your clipboard. But that'll be a 0.1.2 thing.

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

tmplcl-0.1.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

tmplcl-0.1.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file tmplcl-0.1.1.tar.gz.

File metadata

  • Download URL: tmplcl-0.1.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tmplcl-0.1.1.tar.gz
Algorithm Hash digest
SHA256 dd32d20f53575fc2c9598fa36c6fef5ed8c0defb13920542cab6451b38a49076
MD5 905a7add3b27240ee449a68021d73f5d
BLAKE2b-256 c53b1ebc45b867300ba67671d79df3172a6d454c46f97967b3e128801c3268c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for tmplcl-0.1.1.tar.gz:

Publisher: publish.yml on delfanbaum/tmplcl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tmplcl-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: tmplcl-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tmplcl-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fd7765d7103ce7d11cda7059eb541733e0fcfff31ee1322d7f2471901e00f50c
MD5 9ba0491f066be4bd34d1fc24344b256a
BLAKE2b-256 709378b3a16fb369f806e0c06b5611481b5c48def8a13d894f6107ecdcfe5d00

See more details on using hashes here.

Provenance

The following attestation bundles were made for tmplcl-0.1.1-py3-none-any.whl:

Publisher: publish.yml on delfanbaum/tmplcl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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