-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
I'd really like a way to turn off individual style components (such as numbers
) without otherwise affecting the style. This way I can e.g. disable numbers
and changes
(thus removing the gutter) while still respecting user choice for header/grid.
This could be implemented like --style=-numbers
, to remove numbers
from the existing style, or --style=+numbers
to add it. These could of course be grouped, like --style=-numbers,+grid
. Mixing this syntax with an absolute component should be prohibited (e.g. --style=changes,-numbers
), and this can be done in separate flags if desired (e.g. --style=auto --style=-numbers
to override style completely but disable numbers). Alternatively the syntax could look like --style+=numbers,grid --style-=changes
but I can't think offhand of any precedent for this option syntax, so I think just supporting -/+ prefixes on the components makes more sense.
The motivation here is I want numbers off by default, but I don't want to override any other style choices set in the BAT_STYLE
env var (experimentally, the BAT_STYLE
var is applied before reading my config file). Setting --style=-numbers
also shouldn't disable the --style=auto
behavior, whereas --style=changes,header,grid,snip
would.
Open question
What should --style=auto --style=+numbers
do when piped? Should it retain the auto behavior overall, or should it always display numbers? If it's the former, how about --style=auto --style=-numbers --style=+numbers
? I can't decide which way is better. Though really the problem here is that auto
is a specific style instead of being a separate flag, or even a modifier to individual components (that would actually be really nice, if I could e.g. turn off numbers/changes when piped but keep header/grid/snip).
I suppose right now I'm inclined to say --style=auto --style=-numbers --style=+numbers
should definitely display numbers when piped, and --style=auto --style=+numbers
probably should as well just for consistency (i.e. --style=+numbers
means display numbers even when piped, no matter what the inherited style is).
And then I recommend considering the idea of having a per-component modifier for auto behavior (such as --style=header,grid,snip,*numbers,*changes
and --style=+*numbers
; or maybe some other sigil that doesn't need shell escaping). I'll file another issue on this. (Edit: #1743)