public function export( $args, $assoc_args ) {

		$pod_name = $assoc_args['pod'];

		unset( $assoc_args['pod'] );

		$pod = pods( $pod_name, null, false );

		if ( ! $pod->valid() ) {
			WP_CLI::error( sprintf( __( 'Pod "%s" does not exist.', 'pods' ), $assoc_args['pod'] ) );
		}

		$params = array(
			'fields' => pods_v( 'fields', $assoc_args, null, true ),
			'depth'  => (int) pods_v( 'depth', $assoc_args, 1, true ),
		);

		// Handle custom find() params.
		$find_params = pods_v( 'params', $assoc_args, null, true );

		if ( is_string( $find_params ) ) {
			$params['params'] = array();

			if ( false !== strpos( $params['params'], '{' ) ) {
				// Pull the find params from JSON format.
				$params['params'] = json_decode( $params['params'], true );
			} else {
				// Pull the find params from string argument format.
				wp_parse_str( $find_params, $params['params'] );
			}
		}

		$data = false;

		try {
			$data = $pod->export_data( $params );
		} catch ( Exception $e ) {
			WP_CLI::error( sprintf( __( 'Error exporting pod items: %s', 'pods' ), $e->getMessage() ) );
		}

		if ( ! empty( $data ) ) {
			// Load PodsMigrate class file for use.
			pods_migrate();

			$file = $assoc_args['file'];

			$export_file = PodsMigrate::export_data_to_file( $file, $data );

			if ( $export_file ) {
				WP_CLI::success( sprintf( __( 'Pod items exported: %s', 'pods' ), $export_file ) );
			} else {
				WP_CLI::error( __( 'Pod items not exported.', 'pods' ) );
			}
		} else {
			WP_CLI::error( __( 'No pod item export data found.', 'pods' ) );
		}

	}