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

Allow using template in custom directory #770

Merged
merged 4 commits into from
Dec 28, 2024

Conversation

tschettervictor
Copy link
Collaborator

This PR will allow users to specify any template directory to use with Bastille.
If the template is not found in the template directory, it will check the current directory and try to determine if a Bastillefile is present. If not, it will exit as normal.

@michael-o
Copy link
Contributor

What is actually the usecase here?

@tschettervictor
Copy link
Collaborator Author

Running a temple in current directory.

Right now one can only run templates when the are in two locations. The templates directory, or one directory lower than PWD.

Say I have a template I'm working on inside a folder called "guacamole" that I want to run. I would first have to back up one directory and then have to run the template command with "directory/guacamole"

This PR simply allows me to run "guacamole" as the template arg.

@michael-o
Copy link
Contributor

I see, but running nested local templates would still not be possible since you need to use a slash..

@tschettervictor
Copy link
Collaborator Author

It is possible currently. And would still be possible with this PR. If you look at the case command, there are only two options, the template directory and the current directory/other.

This PR simply adds an additional case block allowing for any other input. It will check if that input is a directory, then if it is, check if there is a Bastillefile inside. If not, exit.

@bmac2
Copy link
Collaborator

bmac2 commented Dec 28, 2024

tested the following:

  1. standard location templates - passed
  2. put a template in my home directory and applied it - passed
  3. templates in /usr/local/bastille/templates/bastillebsd-templates - passed

@bmac2 bmac2 merged commit 649c337 into BastilleBSD:master Dec 28, 2024
1 check passed
yaazkal pushed a commit that referenced this pull request Dec 29, 2024
This reverts commit 649c337, reversing
changes made to 7d3ca7b.
yaazkal added a commit that referenced this pull request Dec 29, 2024
Revert "Merge pull request #770 from tschettervictor/patch-7"
@yaazkal
Copy link
Collaborator

yaazkal commented Dec 29, 2024

This was reverted in #779 since it broke the template subcommand.

@tschettervictor feel free to open a new PR.

@tschettervictor
Copy link
Collaborator Author

No issue. After careful consideration, it's probably best to leave it as is.

Templates should follow the structure of project/template anyway in my opinion.

While it would be nice to still do it as I wanted, it's not an important addition.

Thanks for pointing that out.

@tschettervictor
Copy link
Collaborator Author

Oops I just noticed I was actually missing a ;; at the end.

I'll open a new PR for you to test...

@bmac2 bmac2 mentioned this pull request Dec 31, 2024
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.

4 participants