Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Latest commit

 

History

160 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WPry

Go Reference GitHub Release Test codecov License Follow @TangRufus on X Follow @TangRufus.com on Bluesky Sponsor @TangRufus via GitHub Hire Typist Tech

WPry parses WordPress plugin and theme headers.

Built with ♥ by Typist Tech


Tip

Hire Tang Rufus!

I am looking for my next role, freelance or full-time. If you find this tool useful, I can build you more weird stuff like this. Let's talk if you are hiring PHP / Ruby / Go developers.

Contact me at https://typist.tech/contact/


Features

  • Parse WordPress plugin headers from PHP files
  • Parse WordPress theme headers from style.css
  • Parse unzipped plugin and theme directories
  • Parse plugin and theme zip archives (CLI only)
  • Normalize CR and CRLF line endings
  • Apply best-effort decoding (in order):
    1. If input is already valid UTF-8, return it (strip UTF-8 BOM if present)
    2. Check for UTF-32 BOMs (BE/LE) and decode when present
    3. Check for UTF-16 BOMs (BE/LE) and decode when present
    4. Try Windows-1252
    5. Try ISO-8859-1

Library Usage

Go Reference

Refer to Go Reference on pkg.go.dev

CLI Usage

USAGE:
  wpry [<flags>...] <path>

FLAGS:
  -parallel n
    	run n workers simultaneously.
    	If n is 0 or less, GOMAXPROCS is used. Setting -parallel to values higher
    	 than GOMAXPROCS may cause degraded performance due to CPU contention.
    	(default GOMAXPROCS)
  -timeout d
    	If the parser runs longer than duration d, abort. (default 1m0s)
  -v	Print version
  -version
    	Print version

EXAMPLES:
  # Parse a plugin main file
  $ wpry /path/to/index.php

  # Parse a theme main stylesheet
  $ wpry /path/to/style.css

  # Parse an unzipped plugin
  $ wpry /path/to/wp-content/plugins/woocommerce

  # Parse an unzipped theme
  $ wpry /path/to/wp-content/themes/twentytwentynine

  # Parse a plugin zip
  $ wpry /path/to/woocommerce.zip

  # Parse a theme zip
  $ wpry /path/to/twentytwentynine.zip

Tip

Hire Tang Rufus!

There is no need to understand any of these quirks. Let me handle them for you. I am seeking my next job, freelance or full-time.

If you are hiring PHP / Ruby / Go developers, contact me at https://typist.tech/contact/

Examples

Parse a plugin file:

wpry /path/to/index.php
{
  "file": "index.php",
  "plugin": {
    "name": "Full Plugin",
    "uri": "https://example.com/full-plugin",
    "description": "A fully specified plugin.",
    "version": "2.0.0",
    "requires_wp": "6.0",
    "requires_php": "8.0",
    "author": "Full Author",
    "author_uri": "https://example.com/author",
    "license": "GPL-2.0-or-later",
    "license_uri": "https://www.gnu.org/licenses/gpl-2.0.html",
    "update_uri": "https://example.com/update",
    "text_domain": "full-plugin",
    "domain_path": "/lang",
    "requires_plugins": "woocommerce, akismet",
    "network": "true"
  }
}

Parse a theme main stylesheet:

wpry /path/to/style.css
{
  "file": "style.css",
  "theme": {
    "name": "Full Theme",
    "uri": "https://example.com/full-theme",
    "author": "Full Author",
    "author_uri": "https://example.com/author",
    "description": "A fully specified theme.",
    "version": "3.0.0",
    "requires_wp": "6.0",
    "tested_up_to": "6.5",
    "requires_php": "8.0",
    "license": "GPL-2.0-or-later",
    "license_uri": "https://www.gnu.org/licenses/gpl-2.0.html",
    "text_domain": "full-theme",
    "domain_path": "/lang",
    "tags": "custom-background, custom-logo",
    "template": "twentytwentyfive"
  }
}

Parse a directory:

wpry /path/to/wp-content/plugins/woocommerce
wpry /path/to/wp-content/themes/twentytwentynine

Parse a zip archive:

wpry /path/to/woocommerce.zip
wpry /path/to/twentytwentynine.zip

Error result:

{
  "error": "no header found"
}

CLI Installation

Homebrew (macOS / Linux) (Recommended)

brew install typisttech/tap/wpry

Build from Source

go install github.com/typisttech/wpry/cmd/wpry@latest

Linux (Debian & Alpine)

Follow the instructions on https://broadcasts.cloudsmith.com/typisttech/oss

Cloudsmith

Package repository hosting is graciously provided by Cloudsmith. Cloudsmith is the only fully hosted, cloud-native, universal package management solution, that enables your organization to create, store and share packages in any format, to any place, with total confidence.

Credits

WPry is a Typist Tech project and maintained by Tang Rufus, freelance developer for hire.

Full list of contributors can be found here.

Copyright and License

This project is a free software distributed under the terms of the MIT license. For the full license, see LICENSE.

Contribute

Feedbacks / bug reports / pull requests are welcome.

About

Parse WordPress plugin and theme headers.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages