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/
- 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 containing (CLI only)
- Normalize CR and CRLF line endings
- Apply best-effort encoding fallback before header parsing
Heuristics (in order):
- If input is already valid UTF-8, return it (strip UTF-8 BOM if present)
- Check for UTF-32 BOMs (BE/LE) and decode when present
- Check for UTF-16 BOMs (BE/LE) and decode when present
- Try Windows-1252
- Try ISO-8859-1
Refer to Go Reference on pkg.go.dev
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.zipTip
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/
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/twentytwentynineParse a zip archive:
wpry /path/to/woocommerce.zip
wpry /path/to/twentytwentynine.zipError result:
{
"error": "no header found"
}brew install typisttech/tap/wprygo install github.com/typisttech/wpry/cmd/wpry@latestFollow the instructions on https://broadcasts.cloudsmith.com/typisttech/oss
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.
WPry is a Typist Tech project and maintained by Tang Rufus, freelance developer for hire.
Full list of contributors can be found here.
This project is a free software distributed under the terms of the MIT license. For the full license, see LICENSE.
Feedbacks / bug reports / pull requests are welcome.