Skip to main content

Cat structured data , in style

Project description

dotcat: Cat Structured Data, in Style

Dealing with structured data in shell scripts is all but impossible. dotcat gives you the ability to fetch structured data as easily as using cat it.

# Access data by attribute path
dotcat data.json person.name.first
# John
dotcat data.json person.name.last
# Doe

# Controle your output format
dotcat data.json person.name --output=yaml
# name:
#   first: John
#   last: Doe
dotcat data.json person.name --output=json
# {"first": "John", "last": "Doe"}

# List access
dotcat data.json person.friends@0
# {"name":{"first": "Alice", "last": "Smith"}, "age": 25} -> item access
dotcat data.json person.friends@2:4
# [{"name":{"first": "Alice", "last": "Smith"}, "age": 25}, {"name":{"first": "Bob", "last": "Johnson"}, "age": 30}]  -> slice access
dotcat data.json person.friends@4:-1
# ... from 5th to last item

The good times are here

Easily read values from JSON, YAML, TOML, and INI files without complex scripting or manual parsing.

Access deeply nested values using intuitive dot-separated paths (e.g., person.first.name) while controlling the output format with --output flag.

Dotcat is a good unix citizen with well structured exit codes so it can take part of your command pipeline like cat or grep would.

Includes ZSH autocompletion for both file paths and dotted paths, making it even easier to navigate complex data structures.

Installation

If you have a global pip install, this will install dotcat globally:

pip install dotcat

ZSH Completion

Dotcat comes with ZSH completion support that is automatically installed when you install the package with pip. The installation script will:

  1. Look for appropriate ZSH completion directories
  2. Install the completion files if possible
  3. Notify you of the installation location

If the automatic installation fails, you can manually install the completions:

# Copy the completion script to your ZSH completions directory
mkdir -p ~/.zsh/completions
cp /path/to/installed/package/zsh/_dotcat ~/.zsh/completions/

# Or run the installation script directly
dotcat-install-completions

See the ZSH completion README for detailed instructions.

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

dotcat-0.9.4.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

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

dotcat-0.9.4-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file dotcat-0.9.4.tar.gz.

File metadata

  • Download URL: dotcat-0.9.4.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for dotcat-0.9.4.tar.gz
Algorithm Hash digest
SHA256 a24b2f2f23289e47ba015143bd94b9aceebf07af1ab9d9ae753c735876c86000
MD5 9257031c742bf9a162c0bfb12120f8ac
BLAKE2b-256 4bfd8b12c102749e60c59338a188960cdafab9e90a668a60326780ca36d63c16

See more details on using hashes here.

File details

Details for the file dotcat-0.9.4-py3-none-any.whl.

File metadata

  • Download URL: dotcat-0.9.4-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for dotcat-0.9.4-py3-none-any.whl
Algorithm Hash digest
SHA256 12bbdd3b5bfe23a28118415aabe9bc5514aae12ca3229396cdaae8941aed1c89
MD5 4f7b72347bb9be819beb900b3e1d850d
BLAKE2b-256 a2a345c97446655f097b69bc61bb260aedff1277171f37c88488a465611d6e7e

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