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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

recurse template subdirectories #102

Merged
merged 1 commit into from Feb 25, 2019

Conversation

Projects
None yet
2 participants
@grantbowering
Copy link
Contributor

grantbowering commented Feb 8, 2019

This PR should allow an arbitrary directory structure below the action subfolder for templates, so that users have more options to organize their files.
I shamelessly stoleborrowed the core of this change from this StackOverflow answer.
I don't think this will cause any significant performance issues (but I didn't do any large-load perf testing or anything... ymmv).
This would satisfy #28.
Note: I also added a couple of TODOs for some extra tests of unrelated functionality that should probably be added (only because I almost committed this without those lines, and the test suite didn't complain), but I didn't actually write those tests myself, because I'm lazy. 馃槃

@jondot

This comment has been minimized.

Copy link
Owner

jondot commented Feb 10, 2019

Thanks for taking the time to work on this issue! definitely looks like something I want to merge.
I'm wondering about the sort order, I dont think there is one good answer but want get your take on it.

Let's say we have:

0_first.t
1_second.t
injections/
   0_first.t
   1_second.t

should that sort as:

0_first.t
1_second.t
injections/0_first.t
injections/1_second.t

or

0_first.t
injections/0_first.t
1_second.t
injections/1_second.t

from the point of view of the user, not from a technical point of view -- in other words what did the user expect to happen?

@grantbowering

This comment has been minimized.

Copy link
Contributor Author

grantbowering commented Feb 19, 2019

(Sorry I haven't responded to this sooner!)

0_first.t
1_second.t
injections/0_first.t
injections/1_second.t

^ This is what I would expect: everything at the root first, and then each subdir.
But also, to be totally clear about that:

0_first.t
1_second.t
NOT_last.t    <-------------------
injections/0_first.t
injections/1_second.t

^ This is what I would expect, even though alphabetically the injections folder comes before the NOT_last.t file.
However, I think it's a fairly obscure use-case that would even be dependent on sort order anyway (it's probably mostly things that have shell lines in their frontmatter). Since users don't have subdir functionality right now at all, you could add the feature and then see what feedback comes back about sort order with subfolders. (It's hard to know what people want without a real-world example)

@jondot

This comment has been minimized.

Copy link
Owner

jondot commented Feb 20, 2019

Sounds good to me. Any chance you can update the docs to describe this enhanced capabilities?

Probably in this section:
https://github.com/jondot/hygen/blob/master/content/docs/generators.md#structure

@jondot jondot merged commit 624f799 into jondot:master Feb 25, 2019

1 of 2 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.