Skip to content

Regression in vget/vset --format=json #499

Closed
@jonhattan

Description

@jonhattan

The output of vget has changed after the adoption of outputformats engine. This affectes scripted solutions since drush has lost the ability to vset a vgetted value.

This is drush 5 output:

$ drush @dr vget node_options_event --format=json
["status","promote"]

Drush 6:

$ drush @dr vget node_options_event --format=json
{"node_options_event":["status","promote"]}

In drush 5 you could pipe a vgetted value to vset:

$ drush @dr vget node_options_event --format=json | drush @dr vset node_options_event --format=json -
node_options_event was set to                                                                                                                                                                           [success]
array (
  0 => 'status',
  1 => 'promote',
).

In drush6, extra nesting is added:

$ drush @dr vget node_options_event --format=json | drush @dr vset node_options_event --format=json -
node_options_event was set to                                                                                                                                                                           [success]
array (
  'node_options_event' => 
  array (
    0 => 'status',
    1 => 'promote',
  ),
).

OTOH, drush 6 behaviour is consistent when several variables are returned, while drush 5 is useless.

There're two possible resolutions:

  • Change vget to return the value as drush5 when --exact is used.
  • Extend vset to consider input data as multi-variable when - is used as variable name.

I prefer option 1.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions