Skip to content

Commit 022d7c7

Browse files
Use PSR-4 autoloading of existing classes; add remaining test files
1 parent 908e3d3 commit 022d7c7

10 files changed

Lines changed: 186 additions & 3 deletions

File tree

‎.distignore‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.DS_Store
2+
.git
3+
.gitignore
4+
.gitlab-ci.yml
5+
.editorconfig
6+
.travis.yml
7+
behat.yml
8+
circle.yml
9+
bin/
10+
features/
11+
utils/
12+
*.zip
13+
*.tar.gz

‎.editorconfig‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# editorconfig.org
3+
4+
# WordPress Coding Standards
5+
# https://make.wordpress.org/core/handbook/coding-standards/
6+
7+
root = true
8+
9+
[*]
10+
charset = utf-8
11+
end_of_line = lf
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
indent_style = tab
15+
16+
[{.jshintrc,*.json,*.yml,*.feature}]
17+
indent_style = space
18+
indent_size = 2
19+
20+
[{*.txt,wp-config-sample.php}]
21+
end_of_line = crlf
22+
23+
[composer.json]
24+
indent_style = space
25+
indent_size = 4

‎.gitignore‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.DS_Store
2+
wp-cli.local.yml
3+
node_modules/
4+
vendor/
5+
*.zip
6+
*.tar.gz
7+
composer.lock

‎LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (C) 2011-2017 WP-CLI Development Group (https://github.com/wp-cli/shell-command/contributors)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

‎README.md‎

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
wp-cli/shell-command
2+
====================
3+
4+
Interactive PHP console.
5+
6+
[![Build Status](https://travis-ci.org/wp-cli/shell-command.svg?branch=master)](https://travis-ci.org/wp-cli/shell-command)
7+
8+
Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing)
9+
10+
## Using
11+
12+
~~~
13+
wp shell [--basic]
14+
~~~
15+
16+
`wp shell` allows you to evaluate PHP statements and expressions
17+
interactively, from within a WordPress environment. Type a bit of code,
18+
hit enter, and see the code execute right before you. Because WordPress
19+
is loaded, you have access to all the functions, classes and globals
20+
that you can use within a WordPress plugin, for example.
21+
22+
**OPTIONS**
23+
24+
[--basic]
25+
Start in fail-safe mode, even if Boris is available.
26+
27+
**EXAMPLES**
28+
29+
# Call get_bloginfo() to get the name of the site.
30+
$ wp shell
31+
wp> get_bloginfo( 'name' );
32+
=> string(6) "WP-CLI"
33+
34+
## Installing
35+
36+
Installing this package requires WP-CLI v0.23.0 or greater. Update to the latest stable release with `wp cli update`.
37+
38+
Once you've done so, you can install this package with `wp package install wp-cli/shell-command`.
39+
40+
## Contributing
41+
42+
We appreciate you taking the initiative to contribute to this project.
43+
44+
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.
45+
46+
### Reporting a bug
47+
48+
Think you’ve found a bug? We’d love for you to help us get it fixed.
49+
50+
Before you create a new issue, you should [search existing issues](https://github.com/wp-cli/shell-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.
51+
52+
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/shell-command/issues/new) with the following:
53+
54+
1. What you were doing (e.g. "When I run `wp post list`").
55+
2. What you saw (e.g. "I see a fatal about a class being undefined.").
56+
3. What you expected to see (e.g. "I expected to see the list of posts.")
57+
58+
Include as much detail as you can, and clear steps to reproduce if possible.
59+
60+
### Creating a pull request
61+
62+
Want to contribute a new feature? Please first [open a new issue](https://github.com/wp-cli/shell-command/issues/new) to discuss whether the feature is a good fit for the project.
63+
64+
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:
65+
66+
1. Create a feature branch for each contribution.
67+
2. Submit your pull request early for feedback.
68+
3. Include functional tests with your changes. [Read the WP-CLI documentation](https://wp-cli.org/docs/pull-requests/#functional-tests) for an introduction.
69+
4. Follow the [WordPress Coding Standards](http://make.wordpress.org/core/handbook/coding-standards/).
70+
71+
72+
*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.*

‎composer.json‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "wp-cli/shell-command",
3+
"description": "Interactive PHP console.",
4+
"type": "wp-cli-package",
5+
"homepage": "https://github.com/wp-cli/shell-command",
6+
"support": {
7+
"issues": "https://github.com/wp-cli/shell-command/issues"
8+
},
9+
"license": "MIT",
10+
"authors": [
11+
{
12+
"name": "Daniel Bachhuber",
13+
"email": "daniel@runcommand.io",
14+
"homepage": "https://runcommand.io"
15+
}
16+
],
17+
"minimum-stability": "dev",
18+
"autoload": {
19+
"psr-4": {
20+
"": "src/",
21+
"WP_CLI\\": "src/WP_CLI"
22+
},
23+
"files": [ "shell-command.php" ]
24+
},
25+
"require": {},
26+
"require-dev": {
27+
"behat/behat": "~2.5"
28+
},
29+
"extra": {
30+
"commands": [
31+
"shell"
32+
]
33+
}
34+
}

‎shell-command.php‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
if ( ! class_exists( 'WP_CLI' ) ) {
4+
return;
5+
}
6+
7+
$autoload = dirname( __FILE__ ) . '/vendor/autoload.php';
8+
if ( file_exists( $autoload ) ) {
9+
require_once $autoload;
10+
}
11+
12+
WP_CLI::add_command( 'shell', 'Shell_Command' );
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,3 @@ public function __invoke( $_, $assoc_args ) {
4949
}
5050
}
5151
}
52-
53-
\WP_CLI::add_command( 'shell', 'Shell_Command' );
54-
File renamed without changes.

‎wp-cli.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require:
2+
- shell-command.php

0 commit comments

Comments
 (0)