OSDN Git Service

Update man page for `wp post create`
authorgoldenapples <goldenapplesdesign@gmail.com>
Fri, 15 Feb 2013 18:29:04 +0000 (10:29 -0800)
committergoldenapples <goldenapplesdesign@gmail.com>
Fri, 15 Feb 2013 18:58:24 +0000 (10:58 -0800)
Still can't get synopsis to render correctly though. After adding
optional positional argument to synopsis, all calls generate an 'unknown
parameter' warning.

man-src/post-create.txt
man/post-create.1
php/commands/post.php

index 75c4de2..0a2bb1e 100644 (file)
@@ -1,14 +1,31 @@
 ## OPTIONS
 
+* `<filename>`:
+
+       Read post content from <filename>. If this value is present, the 
+       `--post_content` argument will be ignored.
+
+       Passing `-` as the filename will cause post content to
+       be read from STDIN.
+
 * `--<field>`=<value>:
 
        Field values for the new post. See wp_insert_post().
 
+* `--edit`:
+
+       Immediately open system's editor to write or edit post content. 
+       
+       (If content is read from a file, from STDIN, or from the `--post_content`
+       argument, that text will be loaded into the editor; otherwise, an empty
+       file will be opened.) 
+
 * `--porcelain`:
 
        Output just the new post id.
 
 ## EXAMPLES
 
-       wp post create --post_type=page --post_status=publish --post_title='A new
-page'
+       wp post create --post_type=page --post_status=publish --post_title='A new page'
+
+       wp post create file.txt --post_type=post --post_title='Post from file'
index 88d81ea..12e7be4 100644 (file)
@@ -7,17 +7,35 @@
 \fBwp\-post\-create\fR \- Create a post\.
 .
 .SH "SYNOPSIS"
-wp post create \-\-\fIfield\fR=\fIvalue\fR [\-\-edit] [\-\-porcelain]
+wp post create [\fIfilename\fR] \-\-\fIfield\fR=\fIvalue\fR [\-\-edit] [\-\-porcelain]
 .
 .SH "OPTIONS"
 .
 .TP
+\fB<filename>\fR:
+.
+.IP
+Read post content from \fIfilename\fR\. If this value is present, the \fB\-\-post_content\fR argument will be ignored\.
+.
+.IP
+Passing \fB\-\fR as the filename will cause post content to be read from STDIN\.
+.
+.TP
 \fB\-\-<field>\fR=\fIvalue\fR:
 .
 .IP
 Field values for the new post\. See wp_insert_post()\.
 .
 .TP
+\fB\-\-edit\fR:
+.
+.IP
+Immediately open system\'s editor to write or edit post content\.
+.
+.IP
+(If content is read from a file, from STDIN, or from the \fB\-\-post_content\fR argument, that text will be loaded into the editor; otherwise, an empty file will be opened\.)
+.
+.TP
 \fB\-\-porcelain\fR:
 .
 .IP
@@ -27,9 +45,9 @@ Output just the new post id\.
 .
 .nf
 
-wp post create \-\-post_type=page \-\-post_status=publish \-\-post_title=\'A new
+wp post create \-\-post_type=page \-\-post_status=publish \-\-post_title=\'A new page\'
+
+wp post create file\.txt \-\-post_type=post \-\-post_title=\'Post from file\'
 .
 .fi
-.
-.P
-page\'
+
index fe79507..7be856b 100644 (file)
@@ -12,7 +12,7 @@ class Post_Command extends \WP_CLI\CommandWithDBObject {
        /**
         * Create a post.
         *
-        * @synopsis [<file>] --<field>=<value> [--porcelain]
+        * @synopsis [<filename>] --<field>=<value> [--edit] [--porcelain]
         */
        public function create( $args, $assoc_args ) {
                if ( ! empty( $args[0] ) ) {