Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#5 | 1759174-5-features-drush_fd_unified.patch | 988 bytes | pfrenssen |
#3 | 1759174-3.patch | 992 bytes | roderik |
#1 | 1759174-1-features-drush_fd_unified.patch | 1.33 KB | pfrenssen |
Comments
Comment #1
pfrenssenComment #2
mpotter CreditAttribution: mpotter commentedI'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.
Comment #3
roderikYes, 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)
Comment #4
mpotter CreditAttribution: mpotter commentedNo, please, anything but "context". LOL, it's one of those over-used words already in Drupal.
How about something simply like --lines ?
Comment #5
pfrenssen--lines
it shall be!Comment #6
mpotter CreditAttribution: mpotter commentedCommitted to cd965d7.