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

[buildozer]: Support adding symbols instead of literal strings #1232

Open
justhecuke opened this issue Jan 18, 2024 · 2 comments
Open

[buildozer]: Support adding symbols instead of literal strings #1232

justhecuke opened this issue Jan 18, 2024 · 2 comments

Comments

@justhecuke
Copy link

If I want to, for example, add a symbol with a value to a list, that is not possible right now.

buildozer 'add tags SOME_CONST' //pkg:target
-->
some_rule(
  name = "target",
  tags = ["SOME_CONST"],
  ...
)

What I want is the ability to do something such as:

buildozer --symbol 'add tags SOME_CONST' //pkg:target
-->
some_rule(
  name = "target",
  tags = [SOME_CONST],
  ...
)

and

buildozer --symbol 'set tags LIST_CONST' //pkg:target
-->
some_rule(
  name = "target",
  tags = LIST_CONST,
  ...
)

In this way, we can use buildozer better for larger refactors if we want to centralize control of a few key attributes without needing to create a mess of macros and rules.

@stagnation
Copy link

Nice idea! I have historically wanted all tags to be included as literals, to have a centralized location with documentation for what they all mean. And to reduce the risk of typos that are very hard to catch after the fact.
At one point I tried to do a post-process sed to make them literals after the fact, I think that should work. I did not look into the tables configuration to temporarily define tags as not-strings either, though maybe that works.

@tetromino
Copy link

I'd suggest expanding this FR to support adding arbitrary non-string values - for example, structs, dicts, etc., as well as raw symbols.

(There are various tricks you can do with quoting/unquoting, but it would be good to have a solution that works properly out of the box.)

@Jimilian FYI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants