Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions includes/class-gf-cli-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,15 @@ function form_list( $args, $assoc_args ) {
* [--porcelain]
* : Overrides the standard success message with just the export file path
*
* [--filename=<filename>]
* : The filename for the form to export. Defaults to the current date.
*
* ## EXAMPLES
*
* wp gf form export 1
* wp gf form export
*
* @synopsis [<form-id>] [--dir=<dir>] [--porcelain]
* @synopsis [<form-id>] [--dir=<dir>] [--porcelain] [--filename=<filename>]
*/
function export( $args, $assoc_args ) {

Expand All @@ -138,7 +141,11 @@ function export( $args, $assoc_args ) {
$forms_json = json_encode( $forms );

// Set the filename of the export
$filename = 'gravityforms-export-' . date( 'Y-m-d' ) . '.json';
if ( isset( $assoc_args['filename'] ) ) {
$filename = $assoc_args['filename'];
} else {
$filename = 'gravityforms-export-' . date( 'Y-m-d' ) . '.json';
}

// If the export directory is set
if ( isset( $assoc_args['dir'] ) ) {
Expand Down