It would be very helpful to have the output from config-get-tracked (cgt) and config-get-non-tracked (cgnt) contain the component identifier in a format that can be easily copied, or piped to other commands.

Comments

rijidij’s picture

Rijidij created an issue.

Here is a patch that adds the --id option to config-get-tracked (cgt) and config-get-non-tracked (cgnt) drush commands.
This option will print the component identifier in the first column of the command output.
You can cut and paste, or pipe the identifier to other commands.

Here is an example of cgnt (with the --id option) piped through grep and awk to print a nice list of component IDs, separated by spaces.

drush cgnt --id | grep --color=none "field_something" | awk '{printf "\47%s\47 ", $1}'

Note the use of the "--color=none" option on the grep command. This is to avoid inclusion of shell colour code characters in the output.
The "\47" escape sequence wraps each ID in single quotes to escape them from the shell (in case they contain pipe characters, etc.).

When you're happy with the component list, you can then pipe the whole thing into the csta command, like this:

drush cgnt --id | grep --color=none "field_something" | awk '{printf "\47%s\47 ", $1}' | xargs drush csta --exclude-dependencies --exclude-optionals

I hope you all find this useful.

rijidij’s picture

Tried to add patch file to previous comment...

rijidij’s picture

Status: Active » Needs review
rijidij’s picture

Assigned: rijidij » Unassigned