-
Notifications
You must be signed in to change notification settings - Fork 230
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 there an include/source feature? #78
Comments
That sounds like a good enhancement, @RamiAwar ? However, I think that concept of "include" has a lot of gotchas and may be a bit challenging to implement:
Instead of this, my suggestion would be: Changes
On startup,
type SnippetsFiles {
Snippets []Snippets
}
type Snippets struct {
Filename string
Snippets []SnippetInfo `toml:"snippets"`
}
type SnippetInfo struct {
Description string `toml:"description"`
Command string `toml:"command"`
Tag []string `toml:"tag"`
Output string `toml:"output"`
} More impact
Optionally, skip sync of a file if empty string provided. Example: sync
|
Hey @jaroslawhartman ! So you mean to suggest that because embedding snippets in other snippets is difficult, maybe we can solve part of the problem and allow multiple snippet files? |
Hi @RamiAwar - yes, I'd say so. Effectively this should allow for configuration separation as requested in this ticket. |
@jaroslawhartman Okay, I like the proposal. I think we could start even simpler and only sync the first file in that list. The rest we just ignore. As for "merging" snippets from different, we just read everything in order. No merging needed, just overwrite where necessary. I don't think we have a unique identifier for a command other than the command itself, and that means only description and tags would be overwritten I guess. Adding new snippets needs to stay easy though. If we want to support HOME + WORK + other, we have to make adding to any of those 'environments' easy and without workarounds needed. This makes me think we need some identifier for a snippet file, so maybe a simple list is not enough. I'm imagining the simplest syntax would be something like: But it does kind of mess with the concept of 'tags' that we already have a bit. I would expect to be able to search across 'work' snippets only, or 'home' snippets only. Maybe we can support this by auto-tagging snippets that come from different files with the file identifier itself (ex. I might be going a bit too far with this 😁 You tell me! |
can I have my pet snippet to include another pet snippet and have both available to pet search?
use case: I have some private commands that I sync across multiple machines. in addition to that, I also have some more commands for my work use only and would like clear separation between these two sets. from time to time, I make changes to both sets. my current solution is to sync the two pet snippet files to have the work pet snippet to pick up missing items from private pet snippet. ideally I would like my work pet snippet automatically picks up everything from my private pet snippet. the way I envision this to work is to have my work pet snippet to include the private pet snippet, i.e., an include or source feature. makes sense?
The text was updated successfully, but these errors were encountered: