Skip to main content

A CLI tool for managing commands like bookmarks

Project description

cmdmark

A CLI tool for managing commands like bookmarks. This Python script provides a simple way to manage and execute frequently used commands via YAML configuration files. Think of it like a bookmark manager, but for your terminal commands.

Features

  • Categorized Commands: Organize your commands into categories stored in subfolders.
  • YAML Configuration: Define commands and their descriptions in easy-to-read YAML files.
  • Interactive Selection: Choose categories, files, and commands interactively from the terminal.
  • Direct Execution: Execute selected commands directly within the script.
  • Git-Aware: Git metadata files (e.g., .git folders) are ignored when listing categories and YAML files.

Setup

  1. Installation:

    The preferred way to install cmdmark is via pipx (recommended) or pip:

    pipx install cmdmark # recommended way.
    # OR
    pip install cmdmark
    

    This will install cmdmark and its dependency, PyYAML. This project requires Python 3.12 or higher.

  2. Configuration Directory: The script uses a configuration directory located at ~/.command_bookmarks. Make sure that the directory exists. You may create some sub-directories in ~/.command_bookmarks to categorize your commands, and create yml files to store the relative commands.

  3. YAML Files: Create YAML files within the configuration directory (or its subdirectories) to define your commands. The structure of the YAML file is as follows:

    commands:
      alias1:
        command: "your_command_here"
        description: "A short description of the command"
      alias2:
        command: "another_command"
        description: "Another description"
    
    • commands: The top-level key.
    • alias1, alias2, etc.: Short, user-friendly aliases for your commands. These are displayed in the selection menu.
    • command: The actual command to be executed.
    • description: (Optional) A brief description of the command.

Usage

  1. Run the script:

    cmdmark
    
  2. Interactive Navigation:

    • The script will first list the available categories (subfolders) within ~/.command_bookmarks.
    • Select a category by entering its number.
    • The script will then list the YAML files within the selected category.
    • Select a YAML file by entering its number.
    • Finally, the script will list the commands defined in the selected YAML file, displaying the alias, the full command and short description.
    • Select a command by entering its number.
  3. Command Execution: The selected command will be executed in your terminal.

Example

Let's say you have the following structure (see tests/samples).

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

cmdmark-0.0.4.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

cmdmark-0.0.4-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file cmdmark-0.0.4.tar.gz.

File metadata

  • Download URL: cmdmark-0.0.4.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.3 Linux/6.11.0-26-generic

File hashes

Hashes for cmdmark-0.0.4.tar.gz
Algorithm Hash digest
SHA256 3e26fe1d34fd9640bda17c8a7c3b11355d3d9f9e083468f4ea8b31c3e56951a0
MD5 eeed515fd6c15e9d684cedbac0f2aa3d
BLAKE2b-256 8be007cc757a9f6d7270e89721cfdc56be5cc65e3c1d167036df0b9d9fb1af8c

See more details on using hashes here.

File details

Details for the file cmdmark-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: cmdmark-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.3 Linux/6.11.0-26-generic

File hashes

Hashes for cmdmark-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7efd3879ebe0f66d632796ab2b0847ef080921a73df698e6be6d9dd4cff22211
MD5 d8ee1571841f3448f3e75790db05ccc3
BLAKE2b-256 055cdb8da9900fa15531ac213d0bac2a4151607d6b6ced8d20c336777cf98c91

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