Skip to content

Commit 94b4717

Browse files
committedApr 3, 2020
Generate new readme
1 parent 9d82e41 commit 94b4717

File tree

2 files changed

+171
-43
lines changed

2 files changed

+171
-43
lines changed
 

‎composer.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@
1818
"extra": {
1919
"branch-alias": {
2020
"dev-master": "1.x-dev"
21-
}
21+
},
22+
"bundled": false,
23+
"commands": [
24+
"revisions list",
25+
"revisions dump",
26+
"revisions clean",
27+
"revisions generate",
28+
"revisions status"
29+
]
2230
},
2331
"autoload": {
2432
"files": [ "revisions-cli.php" ]

‎readme.md

+162-42
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,190 @@
1-
# Revisions CLI [![Build Status](https://travis-ci.org/trepmal/wp-revisions-cli.svg?branch=master)](https://travis-ci.org/trepmal/wp-revisions-cli)
1+
trepmal/wp-revisions-cli
2+
========================
23

3-
WP CLI command for managing revisions
4+
Manage revisions
45

5-
## Installation
6+
[![Build Status](https://travis-ci.org/trepmal/wp-revisions-cli.svg?branch=master)](https://travis-ci.org/trepmal/wp-revisions-cli)
67

7-
### as wp-cli package (recommended)
8+
Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing) | [Support](#support)
89

9-
```
10-
wp package install trepmal/wp-revisions-cli
11-
```
10+
## Using
1211

13-
### as standard plugin (for older installations of wp-cli)
12+
This package implements the following commands:
1413

15-
```
16-
wp plugin install https://github.com/trepmal/wp-revisions-cli/archive/master.zip --activate
17-
```
14+
### wp revisions list
1815

19-
## Usage
16+
List all revisions
2017

18+
~~~
19+
wp revisions list [--post_type=<post-type>] [--post_id=<post-id>] [--fields=<fields>] [--yes] [--format=<format>]
20+
~~~
2121

22-
For a rundown of all commands at any time, run `wp help revisions`
22+
**OPTIONS**
2323

24+
[--post_type=<post-type>]
25+
List revisions for given post type(s).
2426

25-
### `wp revisions clean [<keep>]`
27+
[--post_id=<post-id>]
28+
List revisions for given post. Trumps --post_type.
2629

27-
For all posts, keep only the last `<keep>` revisions for all posts.
30+
[--fields=<fields>]
31+
Comma-separated list of fields to be included in the output.
32+
---
33+
default: ID,post_title,post_parent
34+
---
2835

29-
- `<keep>` *integer*. Defaults to value of `WP_POST_REVISIONS`
30-
- `--post_type=<post_type>` *string*. Clean revisions for given post type. Default any
31-
- `--post_id=<post_id>` *integer*. Clean revisions for given post. (Does not yet accept lists)
32-
- `--after-date=<date>` *string*. Clean revisions published on or after this date. Use YYYY-MM-DD
33-
- `--before-date=<date>` *string*. Clean revisions published on or before this date. Use YYYY-MM-DD
34-
- `--hard` use `wp_delete_post_revision()` when deleting, this picks up any potential related data such as meta or comments.
36+
[--yes]
37+
Answer yes to the confirmation message.
3538

36-
### `wp revisions dump`
39+
[--format=<format>]
40+
Format to use for the output. One of table, csv or json.
3741

38-
Dump all revisions for all posts. Faster than `wp revisions clean -1` since it doesn't query each post.
42+
**EXAMPLES**
3943

40-
- `--hard` Slower. Uses `wp_delete_post_revision()` when deleting, this picks up any potential related data such as meta or comments. Equivalent to `wp revisions clean -1 --hard`
41-
- `--yes` answer *yes* to confirmation message
44+
wp revisions list
45+
wp revisions list --post_id=2
46+
wp revisions list --post_type=post,page
4247

43-
### `wp revisions generate [<count>]`
4448

45-
Generate revisions for posts.
4649

47-
- `<count>` *integer*. Number of revisions to generate per post. Default 15
48-
- `--post_type=<post_type>` *string*. Generate revisions for given post type. Default any
49-
- `--post_id=<post_id>` *integer*. Generate revisions for given post. (Does not yet accept lists)
50+
### wp revisions dump
5051

51-
### `wp revisions list`
52+
Delete all revisions
5253

53-
List revisions.
54+
~~~
55+
wp revisions dump [--hard] [--yes]
56+
~~~
5457

55-
- `--post_type=<post_type>` *string*. Generate revisions for given post type. Default any
56-
- `--post_id=<post_id>` *integer*. Generate revisions for given post. (Does not yet accept lists)
57-
- `--yes` answer *yes* to confirmation message
58+
**OPTIONS**
5859

59-
### `wp revisions status`
60+
[--hard]
61+
Hard delete. Slower, uses wp_delete_post_revision(). Alias to wp revisions clean -1
6062

61-
Get revisions status. Namely, the value of `WP_POST_REVISIONS`
63+
[--yes]
64+
Answer yes to the confirmation message.
6265

66+
**EXAMPLES**
6367

64-
## Credits
68+
wp revisions dump
6569

66-
## License
6770

68-
The MIT License (MIT)
69-
Copyright (c) 2016 Kailey Lampert
70-
[Full text license](LICENSE)
71+
72+
### wp revisions clean
73+
74+
Delete old revisions
75+
76+
~~~
77+
wp revisions clean [<keep>] [--post_type=<post-type>] [--after-date=<yyyy-mm-dd>] [--before-date=<yyyy-mm-dd>] [--post_id=<post-id>] [--hard] [--dry-run]
78+
~~~
79+
80+
**OPTIONS**
81+
82+
[<keep>]
83+
Number of revisions to keep per post. Defaults to WP_POST_REVISIONS if it is an integer
84+
85+
[--post_type=<post-type>]
86+
Clean revisions for given post type(s). Default: any
87+
88+
[--after-date=<yyyy-mm-dd>]
89+
Clean revisions published on or after this date. Default: none.
90+
91+
[--before-date=<yyyy-mm-dd>]
92+
Clean revisions published on or before this date. Default: none.
93+
94+
[--post_id=<post-id>]
95+
Clean revisions for given post.
96+
97+
[--hard]
98+
Hard delete. Slower, uses wp_delete_post_revision().
99+
100+
[--dry-run]
101+
Dry run, just a test, no actual cleaning done.
102+
103+
**EXAMPLES**
104+
105+
wp revisions clean
106+
wp revisions clean 5
107+
wp revisions clean --post_id=2
108+
wp revisions clean 5 --post_type=post,page
109+
wp revisions clean --after-date=2015-11-01 --before-date=2015-12-30
110+
wp revisions clean --after-date=2015-11-01 --before-date=2015-12-30 --dry-run
111+
112+
113+
114+
### wp revisions generate
115+
116+
Generate revisions
117+
118+
~~~
119+
wp revisions generate [<count>] [--post_type=<post-type>] [--post_id=<post-id>]
120+
~~~
121+
122+
**OPTIONS**
123+
124+
[<count>]
125+
Number of revisions to generate per post. Default 15
126+
127+
[--post_type=<post-type>]
128+
Generate revisions for given post type(s). Default any
129+
130+
[--post_id=<post-id>]
131+
Generate revisions for given post.
132+
133+
**EXAMPLES**
134+
135+
wp revisions generate 10
136+
wp revisions generate --post_id=2
137+
wp revisions generate 2 --post_type=post,page
138+
139+
140+
141+
### wp revisions status
142+
143+
Get revision status
144+
145+
~~~
146+
wp revisions status
147+
~~~
148+
149+
**OPTIONS**
150+
151+
**EXAMPLES**
152+
153+
wp revisions status
154+
155+
## Installing
156+
157+
Installing this package requires WP-CLI v2.1 or greater. Update to the latest stable release with `wp cli update`.
158+
159+
Once you've done so, you can install this package with:
160+
161+
wp package install git@github.com:trepmal/wp-revisions-cli.git
162+
163+
## Contributing
164+
165+
We appreciate you taking the initiative to contribute to this project.
166+
167+
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.
168+
169+
For a more thorough introduction, [check out WP-CLI's guide to contributing](https://make.wordpress.org/cli/handbook/contributing/). This package follows those policy and guidelines.
170+
171+
### Reporting a bug
172+
173+
Think you’ve found a bug? We’d love for you to help us get it fixed.
174+
175+
Before you create a new issue, you should [search existing issues](https://github.com/trepmal/wp-revisions-cli/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.
176+
177+
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/trepmal/wp-revisions-cli/issues/new). Include as much detail as you can, and clear steps to reproduce if possible. For more guidance, [review our bug report documentation](https://make.wordpress.org/cli/handbook/bug-reports/).
178+
179+
### Creating a pull request
180+
181+
Want to contribute a new feature? Please first [open a new issue](https://github.com/trepmal/wp-revisions-cli/issues/new) to discuss whether the feature is a good fit for the project.
182+
183+
Once you've decided to commit the time to seeing your pull request through, [please follow our guidelines for creating a pull request](https://make.wordpress.org/cli/handbook/pull-requests/) to make sure it's a pleasant experience. See "[Setting up](https://make.wordpress.org/cli/handbook/pull-requests/#setting-up)" for details specific to working on this package locally.
184+
185+
## Support
186+
187+
Github issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support
188+
189+
190+
*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.*

0 commit comments

Comments
 (0)
Please sign in to comment.