mirror of
https://ghproxy.net/https://github.com/wp-cli/extension-command.git
synced 2025-08-18 05:21:17 +08:00
Use PSR-4 autoloading of existing classes; add remaining test files
This commit is contained in:
parent
1bbcece353
commit
24d2ebf12a
15 changed files with 269 additions and 6 deletions
13
.distignore
Normal file
13
.distignore
Normal file
|
@ -0,0 +1,13 @@
|
|||
.DS_Store
|
||||
.git
|
||||
.gitignore
|
||||
.gitlab-ci.yml
|
||||
.editorconfig
|
||||
.travis.yml
|
||||
behat.yml
|
||||
circle.yml
|
||||
bin/
|
||||
features/
|
||||
utils/
|
||||
*.zip
|
||||
*.tar.gz
|
25
.editorconfig
Normal file
25
.editorconfig
Normal file
|
@ -0,0 +1,25 @@
|
|||
# This file is for unifying the coding style for different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
# WordPress Coding Standards
|
||||
# https://make.wordpress.org/core/handbook/coding-standards/
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_style = tab
|
||||
|
||||
[{.jshintrc,*.json,*.yml,*.feature}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[{*.txt,wp-config-sample.php}]
|
||||
end_of_line = crlf
|
||||
|
||||
[composer.json]
|
||||
indent_style = space
|
||||
indent_size = 4
|
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 2011-2017 WP-CLI Development Group (https://github.com/wp-cli/extension-command/contributors)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
153
README.md
Normal file
153
README.md
Normal file
|
@ -0,0 +1,153 @@
|
|||
wp-cli/extension-command
|
||||
========================
|
||||
|
||||
Manage WordPress plugins and themes.
|
||||
|
||||
[](https://travis-ci.org/wp-cli/extension-command)
|
||||
|
||||
Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing)
|
||||
|
||||
## Using
|
||||
|
||||
This package implements the following commands:
|
||||
|
||||
### wp plugin
|
||||
|
||||
Manage plugins.
|
||||
|
||||
~~~
|
||||
wp plugin
|
||||
~~~
|
||||
|
||||
**EXAMPLES**
|
||||
|
||||
# Activate plugin
|
||||
$ wp plugin activate hello-dolly
|
||||
Plugin 'hello-dolly' activated.
|
||||
Success: Activated 1 of 1 plugins.
|
||||
|
||||
# Deactivate plugin
|
||||
$ wp plugin deactivate hello-dolly
|
||||
Plugin 'hello-dolly' deactivated.
|
||||
Success: Deactivated 1 of 1 plugins.
|
||||
|
||||
# Delete plugin
|
||||
$ wp plugin delete hello-dolly
|
||||
Deleted 'hello-dolly' plugin.
|
||||
Success: Deleted 1 of 1 plugins.
|
||||
|
||||
# Install the latest version from wordpress.org and activate
|
||||
$ wp plugin install bbpress --activate
|
||||
Installing bbPress (2.5.9)
|
||||
Downloading install package from https://downloads.wordpress.org/plugin/bbpress.2.5.9.zip...
|
||||
Using cached file '/home/vagrant/.wp-cli/cache/plugin/bbpress-2.5.9.zip'...
|
||||
Unpacking the package...
|
||||
Installing the plugin...
|
||||
Plugin installed successfully.
|
||||
Activating 'bbpress'...
|
||||
Plugin 'bbpress' activated.
|
||||
Success: Installed 1 of 1 plugins.
|
||||
|
||||
|
||||
|
||||
### wp theme
|
||||
|
||||
Manage themes.
|
||||
|
||||
~~~
|
||||
wp theme
|
||||
~~~
|
||||
|
||||
**EXAMPLES**
|
||||
|
||||
# Install the latest version of a theme from wordpress.org and activate
|
||||
$ wp theme install twentysixteen --activate
|
||||
Installing Twenty Sixteen (1.2)
|
||||
Downloading install package from http://downloads.wordpress.org/theme/twentysixteen.1.2.zip...
|
||||
Unpacking the package...
|
||||
Installing the theme...
|
||||
Theme installed successfully.
|
||||
Activating 'twentysixteen'...
|
||||
Success: Switched to 'Twenty Sixteen' theme.
|
||||
|
||||
# Get details of an installed theme
|
||||
$ wp theme get twentysixteen --fields=name,title,version
|
||||
+---------+----------------+
|
||||
| Field | Value |
|
||||
+---------+----------------+
|
||||
| name | Twenty Sixteen |
|
||||
| title | Twenty Sixteen |
|
||||
| version | 1.2 |
|
||||
+---------+----------------+
|
||||
|
||||
# Get status of theme
|
||||
$ wp theme status twentysixteen
|
||||
Theme twentysixteen details:
|
||||
Name: Twenty Sixteen
|
||||
Status: Active
|
||||
Version: 1.2
|
||||
Author: the WordPress team
|
||||
|
||||
|
||||
|
||||
### wp theme mod
|
||||
|
||||
Manage theme mods.
|
||||
|
||||
~~~
|
||||
wp theme mod
|
||||
~~~
|
||||
|
||||
**EXAMPLES**
|
||||
|
||||
# Set the 'background_color' theme mod to '000000'.
|
||||
$ wp theme mod set background_color 000000
|
||||
Success: Theme mod background_color set to 000000
|
||||
|
||||
# Get single theme mod in JSON format.
|
||||
$ wp theme mod get background_color --format=json
|
||||
[{"key":"background_color","value":"dd3333"}]
|
||||
|
||||
# Remove all theme mods.
|
||||
$ wp theme mod remove --all
|
||||
Success: Theme mods removed.
|
||||
|
||||
## Installing
|
||||
|
||||
Installing this package requires WP-CLI v0.23.0 or greater. Update to the latest stable release with `wp cli update`.
|
||||
|
||||
Once you've done so, you can install this package with `wp package install wp-cli/extension-command`.
|
||||
|
||||
## Contributing
|
||||
|
||||
We appreciate you taking the initiative to contribute to this project.
|
||||
|
||||
Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.
|
||||
|
||||
### Reporting a bug
|
||||
|
||||
Think you’ve found a bug? We’d love for you to help us get it fixed.
|
||||
|
||||
Before you create a new issue, you should [search existing issues](https://github.com/wp-cli/extension-command/issues?q=label%3Abug%20) to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version.
|
||||
|
||||
Once you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please [create a new issue](https://github.com/wp-cli/extension-command/issues/new) with the following:
|
||||
|
||||
1. What you were doing (e.g. "When I run `wp post list`").
|
||||
2. What you saw (e.g. "I see a fatal about a class being undefined.").
|
||||
3. What you expected to see (e.g. "I expected to see the list of posts.")
|
||||
|
||||
Include as much detail as you can, and clear steps to reproduce if possible.
|
||||
|
||||
### Creating a pull request
|
||||
|
||||
Want to contribute a new feature? Please first [open a new issue](https://github.com/wp-cli/extension-command/issues/new) to discuss whether the feature is a good fit for the project.
|
||||
|
||||
Once you've decided to commit the time to seeing your pull request through, please follow our guidelines for creating a pull request to make sure it's a pleasant experience:
|
||||
|
||||
1. Create a feature branch for each contribution.
|
||||
2. Submit your pull request early for feedback.
|
||||
3. Include functional tests with your changes. [Read the WP-CLI documentation](https://wp-cli.org/docs/pull-requests/#functional-tests) for an introduction.
|
||||
4. Follow the [WordPress Coding Standards](http://make.wordpress.org/core/handbook/coding-standards/).
|
||||
|
||||
|
||||
*This README.md is generated dynamically from the project's codebase using `wp scaffold package-readme` ([doc](https://github.com/wp-cli/scaffold-package-command#wp-scaffold-package-readme)). To suggest changes, please submit a pull request against the corresponding part of the codebase.*
|
41
composer.json
Normal file
41
composer.json
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"name": "wp-cli/extension-command",
|
||||
"description": "Manage WordPress plugins and themes.",
|
||||
"type": "wp-cli-package",
|
||||
"homepage": "https://github.com/wp-cli/extension-command",
|
||||
"support": {
|
||||
"issues": "https://github.com/wp-cli/extension-command/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Daniel Bachhuber",
|
||||
"email": "daniel@runcommand.io",
|
||||
"homepage": "https://runcommand.io"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"": "src/",
|
||||
"WP_CLI\\": "src/WP_CLI"
|
||||
},
|
||||
"files": [ "extension-command.php" ]
|
||||
},
|
||||
"require": {},
|
||||
"require-dev": {
|
||||
"behat/behat": "~2.5",
|
||||
"wp-cli/wp-cli": "*"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.x-dev"
|
||||
},
|
||||
"commands": [
|
||||
"plugin",
|
||||
"theme",
|
||||
"theme mod"
|
||||
]
|
||||
}
|
||||
}
|
14
extension-command.php
Normal file
14
extension-command.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
if ( ! class_exists( 'WP_CLI' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$autoload = dirname( __FILE__ ) . '/vendor/autoload.php';
|
||||
if ( file_exists( $autoload ) ) {
|
||||
require_once $autoload;
|
||||
}
|
||||
|
||||
WP_CLI::add_command( 'plugin', 'Plugin_Command' );
|
||||
WP_CLI::add_command( 'theme', 'Theme_Command' );
|
||||
WP_CLI::add_command( 'theme mod', 'Theme_Mod_Command' );
|
|
@ -989,5 +989,3 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade {
|
|||
return ! WP_CLI::launch( $command . $path );
|
||||
}
|
||||
}
|
||||
|
||||
WP_CLI::add_command( 'plugin', 'Plugin_Command' );
|
|
@ -772,5 +772,3 @@ class Theme_Command extends \WP_CLI\CommandWithUpgrade {
|
|||
parent::_list( $_, $assoc_args );
|
||||
}
|
||||
}
|
||||
|
||||
WP_CLI::add_command( 'theme', 'Theme_Command' );
|
|
@ -198,5 +198,3 @@ class Theme_Mod_command extends WP_CLI_Command {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
WP_CLI::add_command( 'theme mod', 'Theme_Mod_Command' );
|
2
wp-cli.yml
Normal file
2
wp-cli.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
require:
|
||||
- extension-command.php
|
Loading…
Add table
Add a link
Reference in a new issue