krang_create_story - Create a story via the command line
$ bin/krang_create_story --type="article" --title="..." --slug="..."
This script creates a story in Krang and publishes it.
When the script succeeds it will print a single line and exit
OK ID URL
The ID and URL is the URL of the published form. Errors will result in a non-zero exit and an error message on STDERR.
For example, calling:
bin/krang_create_story --type="article" \
--title="Test Article" \
--slug="test_arcticle" \
--element paragraph='some text' \
--element metadata_title='some more text'
Might result in:
OK 10 mysite.com/test_article FA47EA5C-0F23-11DE-9999-71D3CB6E427A
--site "mysite.com"
--category "/foo/bar"
If the element you are trying to setup uses an Array or a Hash as it's data store you can just format your data to look like a Perl Array or Hash:
--element foo="[1, 2, 3, 4]"
--element bar="['one', 'two', 'three']"
--element baz="{ asd => 1, qwe => 2 }"
If this is what you want, make sure to start and end your value with
the right opening and closing tokens (ie, either [] or {}).
If the element's name ends with _date then we will convert it into a Time::Piece
object and assume the date is in the format DD-MM-YYYY.
--element start_date="12-03-2009"
If the element's name ends with _time then we will convert it into a Time::Piece
object and assume the date is in the format HH:MM.
--element start_time="14:30"
If you need to handle a nested element then you can use a special syntax wrapping
your data in angle-brackets <>. The data inside of the angle-brackets is
syntactically treated as a Perl Hash which is used to create and fill any child elements.
We only handle the case of nesting 1 level deep. Anything else is more complicated
than this script can handle.
--element complex_element="< child_1 => 'foo', child_2 => 'bar' >"
--media audio="itchyscratchy.mp3"
--story-link more_info="123"
--story-link more_info="FA47EA5C-0F23-11DE-9999-71D3CB6E427A"
DD-MM-YYYY.
--type,
--category or --site arguments are ignored.