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 !include to skip missing files #1563

Closed
indigoviolet opened this issue Mar 7, 2023 · 3 comments
Closed

Allow !include to skip missing files #1563

indigoviolet opened this issue Mar 7, 2023 · 3 comments

Comments

@indigoviolet
Copy link

In shared repos, it would be nice to have a way for users to have their own unshared commands. One way to achieve this is to do

!include private.justfile, and then gitignore the private.justfile. Currently this requires private.justfile to exist.

Could we allow that to be missing? Or, do you have any other suggestions for this use case?

@neunenak
Copy link
Contributor

Maybe a separate directive !include-optional that has the same behavior as !include but does not fail if the file doesn't exist?

I feel like at this point it's probably a good idea to think about what the syntax for specifying arbitrary modifiers to !include might look like, though. The current syntax is that any text at all after !include (minus whitespace-trimming) will be interpreted as a file path. We could add syntax for additional options after that filepath, which wouldn't break anyone's current workflow (maybe !include ./path/to/file.justfile --optional or !include ./path/to/file.justfile optional)?

Also see #929 for discussion about modules, which are supposed to be the more complex and configurable feature which !includes are a quick-and-dirty implementation of. Maybe !include directives can grow to do everything that would be desirable about a modules system.

@pprkut
Copy link

pprkut commented Jan 15, 2024

Imports may be made optional by putting a ? after the import keyword

I think this is already implemented now @casey

@casey
Copy link
Owner

casey commented Jan 15, 2024

@pprku Thank you! This is now implemented, you can do import? 'some.justfile' and it will not throw an error if some.justfile isn't present.

@casey casey closed this as completed Jan 15, 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

No branches or pull requests

4 participants