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

Is it possible to programatically edit filters with gmailctl? #381

Closed
RayBB opened this issue Jan 17, 2024 · 2 comments
Closed

Is it possible to programatically edit filters with gmailctl? #381

RayBB opened this issue Jan 17, 2024 · 2 comments
Labels
question Further information is requested

Comments

@RayBB
Copy link
Contributor

RayBB commented Jan 17, 2024

I've done a bit of digging around related to jsonnet and can't find any obvious answers. So I thought maybe someone here would have an idea.

I have a filter that is just for newsletters and that's the one I edit the most by adding a new domain:
For example:

{
  or: [
    {from: "amazon.com"},
    {from: "twitter.com"},
    {from: "facebook.com"},
  ],
}

Is there a way I could programmatically add a new domain to the list? The only thing I can figure out is if you keep a very simple config (no fancy loops) then we could just convert the jsonnet file to json and edit the json.

I'd like to make my own go/bash/etc script and have an alias like gmailctladd newsletters github.com but just not sure how to interface with the jsonnet file.

@mbrt
Copy link
Owner

mbrt commented Jan 18, 2024

I think you could keep the two concepts separate. You maintain your lists in a different file and maintain that programmatically. Your config then imports it and can be as complex as necessary. See e.g. https://jsonnet.org/learning/tutorial.html#imports.

Dealing with jsonnet edits is possible only in special cases because it's Turing complete.

WDYT?

@mbrt mbrt added the question Further information is requested label Jan 18, 2024
@RayBB
Copy link
Contributor Author

RayBB commented Jan 22, 2024

That's that's a nice compromise! If I make something with this I'll let you know :)

@RayBB RayBB closed this as completed Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants