Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix output directory when not /-suffixed #82

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion features/checkbox.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Checkbox Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='checkbox-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' checkbox-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/clone.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Clone Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='clone-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' clone-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
2 changes: 1 addition & 1 deletion features/color_picker.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Color Picker Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='color_picker-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' color_picker-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/date_picker.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Date Picker Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='date_picker-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' date_picker-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/date_time_picker.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Date Time Picker Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='date_time_picker-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' date_time_picker-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/dboverfile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ Feature: DB is prefered over files
Scenario: Export a field group and see if changes to the db over prefered over export files
Given a WP install
And a "number" feature
When I run the command "acf export --field_group='number-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' number-group"
And I remove the fields from "number-group.json"
Then the "number-group" should not have been added to the local groups
2 changes: 1 addition & 1 deletion features/email.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Email Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='email-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' email-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/embed.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Embed Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='embed-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' embed-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/file.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export File Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='file-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' file-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/flexible.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Flexible Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='flexible-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' flexible-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/gallery.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Gallery Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='gallery-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' gallery-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/google_maps.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Google Maps Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='google_maps-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' google_maps-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/image.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Image Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='image-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' image-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/message.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Gallery Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='message-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' message-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/multiple.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Group With Multiple Fields
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='multiple-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' multiple-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/number.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Number Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='number-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' number-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/page_link.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Page Link Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='page_link-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' page_link-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/password.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Password Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='password-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' password-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/post.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export post Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='post-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' post-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/radio.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Radio Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='radio-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' radio-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/relation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Relation Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='relation-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' relation-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/repeater.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Repeater Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='repeater-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' repeater-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/select.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Select Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='select-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' select-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/tab.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Tab Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='tab-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' tab-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/taxonomy.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Taxonomy Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='taxonomy-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' taxonomy-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/text.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Text Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='text-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' text-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/textarea.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Text Area Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='textarea-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' textarea-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/time_picker.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export Time Picker Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='time_picker-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' time_picker-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/truefalse.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export TRUE/FALSE Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='truefalse-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' truefalse-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/url.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export URL Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='url-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' url-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/user.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export User Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='user-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' user-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
2 changes: 1 addition & 1 deletion features/wysiwyg.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Import and Export WYSIWYG Groups
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
When I run the command "acf export --field_group='wysiwyg-group' --export_path='features/bootstrap/test_exports/'"
When I run the command "acf export --export_path='features/bootstrap/test_exports/' wysiwyg-group"
Then the exit code should be 0
And the result should not be empty
And the result string should start with "Success:"
Expand Down
7 changes: 4 additions & 3 deletions lib/acfwpcli/cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static function help() {
*
* ## OPTIONS
*
* [--field_group=<field_group>]
* [<field_group>...]
* : The field group to export, can be used with "My Field Group" or "my-field-group".
*
* [--export_path=<path>]
Expand All @@ -50,10 +50,11 @@ static function help() {
* : Export all the fieldgroups.
*
* @subcommand export
* @synopsis [--field_group=<field_group>] [--export_path=<export_path>] [--all]
* @synopsis [--export_path=<export_path>] [--all] [<field_group>]
*/
function export( $args, $assoc_args ) {
extract( $assoc_args );
$field_group = $args[0];

$field_groups = [];

Expand Down Expand Up @@ -88,7 +89,7 @@ function export( $args, $assoc_args ) {

foreach ( $field_groups as $post ) {
$field_group = \ACFWPCLI\FieldGroup::to_array( $post );
$file = $export_path . sanitize_title( $post->post_title ) . '.json';
$file = $export_path . '/' . sanitize_title( $post->post_title ) . '.json';

\ACFWPCLI\FieldGroup::to_json_file( [$field_group], $file );
WP_CLI::success( "Exported field group: {$post->post_title}" );
Expand Down