App-org2wp
view release on metacpan or search on metacpan
script/org2wp view on Meta::CPAN
# Note: This script is a CLI for Riap function /App/org2wp/org2wp
# and generated automatically using Perinci::CmdLine::Gen version 0.501
use 5.010001;
use strict;
use warnings;
use Log::ger;
use Perinci::CmdLine::Any;
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2022-05-02'; # DATE
our $DIST = 'App-org2wp'; # DIST
our $VERSION = '0.013'; # VERSION
my $cmdline = Perinci::CmdLine::Any->new(
url => "/App/org2wp/org2wp",
program_name => "org2wp",
log => 1,
);
$cmdline->run;
# ABSTRACT: Publish Org document (or heading) to WordPress as blog post
# PODNAME: org2wp
__END__
=pod
=encoding UTF-8
=head1 NAME
org2wp - Publish Org document (or heading) to WordPress as blog post
=head1 VERSION
This document describes version 0.013 of org2wp (from Perl distribution App-org2wp), released on 2022-05-02.
=head1 SYNOPSIS
Usage:
% B<org2wp> [B<--comment-status>=I<str>] [B<--config-path>=I<path>|B<-c>|B<--no-config>|B<-C>] [B<--config-profile>=I<profile>|B<-P>] [B<--debug>|B<--log-level>=I<level>|B<--quiet>|B<--trace>|B<--verbose>] [B<--dry-run>|B<-n>] [(B<--exclude-heading-t...
=head1 DESCRIPTION
This is originally a quick hack because I couldn't make
LL<https://github.com/punchagan/org2blog> on my Emacs installation to
work after some update. C<org2wp> uses the same format as C<org2blog>, but instead
of being an Emacs package, it is a CLI script written in Perl.
First, create C<~/org2wp.conf> containing the API credentials, e.g.:
; use INI (IOD) format for this file
proxy=https://YOURBLOGNAME.wordpress.com/xmlrpc.php
username=YOURUSERNAME
password=YOURPASSWORD
Note that C<proxy> is the endpoint URL of your WordPress instance's XML-RPC
server, which can be hosted on C<wordpress.com> or on other server, including
your own. It has nothing to do with HTTP/HTTPS proxy; the term "proxy" is used
by the L<XMLRPC::Lite> and L<SOAP::Lite> Perl libraries and C<org2wp> simply
uses the same terminology.
You can also put multiple credentials in the configuration file using profile
sections, e.g.:
; use INI (IOD) format for this file
[profile=blog1]
proxy=https://YOURBLOG1NAME.wordpress.com/xmlrpc.php
username=YOURUSERNAME
password=YOURPASSWORD
[profile=blog2]
proxy=https://YOURBLOG2NAME.wordpress.com/xmlrpc.php
username=YOURUSERNAME
password=YOURPASSWORD
and specify which profile you want using command-line option e.g.
C<--config-profile blog1>.
=head3 Document mode
You can use the whole Org document file as a blog post (document mode) or a
single heading as a blog post (heading mode). The default is document mode. To
create a blog post, write your Org document (e.g. in C<post1.org>) using this
format:
#+TITLE: Blog post title
#+CATEGORY: cat1, cat2
#+TAGS: tag1,tag2,tag3
Text of your post ...
...
then:
% org2wp post1.org
this will create a draft post. To publish directly:
% org2wp --publish post1.org
Note that this will also modify your Org file and insert this setting line at
the top:
#+POSTID: 1234
#+POSTTIME: [2020-09-16 Wed 11:51]
where 1234 is the post ID retrieved from the server when creating the post, and
post time will be set to the current local time.
After the post is created, you can update using the same command:
% org2wp post1.org
You can use C<--publish> to publish the post, or C<--no-publish> to revert it to
draft.
script/org2wp view on Meta::CPAN
Choose output format, e.g. json, text.
Default value:
undef
=item B<--json>
Set output format to json.
=item B<--naked-res>
When outputing as JSON, strip result envelope.
Default value:
0
By default, when outputing as JSON, the full enveloped result is returned, e.g.:
[200,"OK",[1,2,3],{"func.extra"=>4}]
The reason is so you can get the status (1st element), status message (2nd
element) as well as result metadata/extra result (4th element) instead of just
the result (3rd element). However, sometimes you want just the result, e.g. when
you want to pipe the result for more post-processing. In this case you can use
`--naked-res` so you just get:
[1,2,3]
=item B<--page-result>
Filter output through a pager.
=item B<--view-result>
View output using a viewer.
=back
=head2 Other options
=over
=item B<--dry-run>, B<-n>
Run in simulation mode (also via DRY_RUN=1).
=item B<--help>, B<-h>, B<-?>
Display help message and exit.
=item B<--password>=I<s>*
=item B<--proxy>=I<s>*
Example: `https://YOURBLOGNAME.wordpress.com/xmlrpc.php`.
Note that `proxy` is the endpoint URL of your WordPress instance's XML-RPC
server, which can be hosted on `wordpress.com` or on other server, including
your own. It has nothing to do with HTTP/HTTPS proxy; the term "proxy" is used
by the <pm:XMLRPC::Lite> and <pm:SOAP::Lite> Perl libraries and `org2wp` simply
uses the same terminology.
=item B<--username>=I<s>*
=item B<--version>, B<-v>
Display program's version and exit.
=back
=head1 COMPLETION
This script has shell tab completion capability with support for several
shells.
=head2 bash
To activate bash completion for this script, put:
complete -C org2wp org2wp
in your bash startup (e.g. F<~/.bashrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.
It is recommended, however, that you install modules using L<cpanm-shcompgen>
which can activate shell completion for scripts immediately.
=head2 tcsh
To activate tcsh completion for this script, put:
complete org2wp 'p/*/`org2wp`/'
in your tcsh startup (e.g. F<~/.tcshrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.
It is also recommended to install L<shcompgen> (see above).
=head2 other shells
For fish and zsh, install L<shcompgen> as described above.
=head1 CONFIGURATION FILE
This script can read configuration files. Configuration files are in the format of L<IOD>, which is basically INI with some extra features.
By default, these names are searched for configuration filenames (can be changed using C<--config-path>): F</home/u1/.config/org2wp.conf>, F</home/u1/org2wp.conf>, or F</etc/org2wp.conf>.
All found files will be read and merged.
To disable searching for configuration files, pass C<--no-config>.
You can put multiple profiles in a single file by using section names like C<[profile=SOMENAME]> or C<[SOMESECTION profile=SOMENAME]>. Those sections will only be read if you specify the matching C<--config-profile SOMENAME>.
( run in 2.640 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )