At times I'm really dying to see just one or two additional lines of context when looking at the output of features-diff. It defaults to only two lines, which is less than usual, since both the diff and git diff commands show 3 lines of context.

I propose to add a --unified=<n> option, so the user can customize the number of context lines. This is the same option as is used for the popular diff and git diff commands.

$ drush fd my_feature --unified=5
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pfrenssen’s picture

Status: Active » Needs review
FileSize
1.33 KB
mpotter’s picture

I'll take a look at this soon. Seems pretty straightforward.

Also wanted to note for others looking here that if you install the latest version of the Features Override module, it will add additional "diff" functionality to the "Review Overrides" tab in the UI that gives more context-specific help on the changes being made. However this doesn't help with the "drush fd" command, so your patch is still useful.

roderik’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
FileSize
992 bytes

Yes, it works, is straightforward, and the patch still applies to 2.x with some offset.

I almost set RTBC... but I don't really like the naming of the option ("unified").

'unified' does not mean "number of context lines". It's a certain output style (formatting), which git produces / which diff produces only when you provide the '--unified' or '-u' option.

And 'drush fd' output is not 'unified' style.

So I propose to name '--context', for number of context lines.

(Note: for the same in the web UI, see #2052187: Customize output (context and spacing) in features UI diff)

mpotter’s picture

No, please, anything but "context". LOL, it's one of those over-used words already in Drupal.

How about something simply like --lines ?

pfrenssen’s picture

--lines it shall be!

mpotter’s picture

Status: Needs review » Fixed

Committed to cd965d7.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.