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

Move the ITEMS_TO_COPY list out of the code #8

Closed
wants to merge 11 commits into from

Conversation

dgou
Copy link
Contributor

@dgou dgou commented Jul 8, 2023

@peterkaminski
Built this on top of #7 to leverage some of the code there and to extend the idea of "simple text files".

Thoughts and ruminations:

  1. I am liking have the external files.
  2. Using .txt to be windows friendlier, but it does feel odd to use that extension on Linux.
  3. On my Linux system, there isn't a single 'config' as was listed in the code, but just a bunch of config files in the root directly. I pretty much added all of them in as a starting point for discussion.
  4. How to let users customize and / or extend the list?
  5. How to list exceptions or carve-outs when copying a big directory like plugins?

For 5) I feel as if there is an existing solution we should be able to borrow, but it is late enough that I can't think of it. .gitignore is one "style", but that has some sharp-edges that I catch myself on, and it's hard to use it to do a partial carve out. Globs seem like a reasonable "high level" hand-wave answer, but I feel like there are other tools that do this and it would be nice to borrow from that rather than reinvent.

For 4) I have two ideas:
a) Read an optional second file (copy-list-custom.txt (names are hard)) after reading the main copy-list.txt. That is easy when all you want to do is extend, but if you want to also excise (such as README.md) that is trickier.
b) Ship a copy-list-template.txt file that is only read if the user doesn't create their own copy-list.txt file to use. And in this case I would add support for a new line type @filename that causes the contents of filename to be included at that point, so that a user who want to extend the template could reference it by name instead of having to keep it manually up to date on each new release (not expecting a lot of changes, but want to permit it).

Hopefully this makes sense on a late Friday, wanted to have something concrete to drive the discussion.
While I based this on #7, I figure that PR can merge separately unless we want to go whole-hog on a Big Fat Greek Wedding Configuration YAML.

osm.py Outdated
for line in items_to_copy_contents.splitlines():
if not line:
continue # Ignore blank lines
line = line.strip() # Allow indentation, esp. for comments.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this strip() should be above the not line, that's fixed in a later commit.

@dgou
Copy link
Contributor Author

dgou commented Jul 8, 2023

Some additional thoughts/notes/bread-crumbs:
For 5) probably a good idea to have a "tell me what matches", so not even a diff, just a "what would you want to copy from the source Vault without regard to how it lines up with any particular destination vault(s)" to make fine-tuning the selections easier.
After stack overflow searching failed again, I started thinking about just having simple ordered list of items, each one a simple pattern of things to either add to the list to copied, or removed from it.

Include: plugins
Exclude: plugins/abc
Include: foo
Exclude: foo/bar
Include: foo/bar/templates

Hmm, seems like something like that should be in PyPI already :-)

@dgou
Copy link
Contributor Author

dgou commented Jul 8, 2023

Made #10 to implement spike of include/exclude idea as a stand-alone script rather than complicating this PR with more commits.

@dgou
Copy link
Contributor Author

dgou commented Jul 9, 2023

Closing this spike, we decided to go in a different direction.

@dgou dgou closed this Jul 9, 2023
@dgou dgou deleted the copy-items-out-of-code branch July 9, 2023 04:21
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

Successfully merging this pull request may close these issues.

1 participant