Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling individual style components without otherwise affecting existing style #1741

Closed
lilyball opened this issue Jul 20, 2021 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@lilyball
Copy link

lilyball commented Jul 20, 2021

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)

@lilyball lilyball added the feature-request New feature or request label Jul 20, 2021
@sharkdp
Copy link
Owner

sharkdp commented Jul 25, 2021

Thank you for your request.

I haven't fully read it but it looks like it's related to #1032 and #1161 (and tickets linked therein). It would be great if you could comment on #1032 instead, if your request adds new information (it looks like it does).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants