Skip to content
This repository was archived by the owner on Nov 22, 2022. It is now read-only.

Unsure how to import a large number of files #7

Open
ngirard opened this issue Dec 3, 2020 · 1 comment
Open

Unsure how to import a large number of files #7

ngirard opened this issue Dec 3, 2020 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@ngirard
Copy link
Contributor

ngirard commented Dec 3, 2020

The documentation -- which is great btw -- doesn't seem to address how to import a large number of files into a Supertag collection, and I couldn't find any script of program in the repo tree that would help.

Do you have any best practices to share ?
Could we imagine a helper tool for this ?
I guess what I'm thinking of, is a program (or a subcommand) that would take as arguments:

  • a name of a Supertag collection, or a mount point;
  • a <path> to the directory to import
  • a tag name that would be affected to all imported files (e.g. inbox)
  • an optional number of path components to strip (e.g. --strip-components=2)

and that would

  • find all files from <path> (possibly ignoring .git dirs using the ignore crate)
  • treat all path components as tags (excluding the leading components if necessary)
  • add the files to the Supertag collection, tagging them with the tags corresponding to the path components, plus the tag given as a parameter (e.g.inbox).

What do you think ?

@amoffat
Copy link
Owner

amoffat commented Dec 4, 2020

A helper tool that does that sounds awesome. It would make it much more convenient to manage lots of files that way. There's no way to do that currently. In addition to skipping common ignorable directories, there could be a field in the default config toml for additional ignore patterns. Or maybe just the ability to pass those ignore patterns in on the commandline.

I think it would be pretty straightforward to implement:

  • define an import command
  • add your commandline options
  • adjust the default config toml to include ignore patterns
  • define an import handler
  • make your import handler essentially walk the import directory, and on each file, do similar logic that the ln handler is doing
  • tests for the import scenarios that you care about

There are some helpers for walking paths in the tests that might be useful for spidering the directory to import. I know there is also walkdir

It's a cool idea, my time this month is limited due to work, but I can provide guidance if you (or anyone else) wishes to tackle it

@amoffat amoffat added enhancement New feature or request help wanted Extra attention is needed labels Dec 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants