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

Utility Imports #15

Open
E8y2FqZE opened this issue May 15, 2024 · 0 comments
Open

Utility Imports #15

E8y2FqZE opened this issue May 15, 2024 · 0 comments

Comments

@E8y2FqZE
Copy link

Is there a good way to import my own utilities globally without manually importing them from every file?

For example, if I have this:

# util.sh

hash_file() {
	md5sum $1 | cut -f1 -d ' ' | tr -d '\n'
}

I can then write a template that imports my utility like this:

# my_template.conf.esh
<% . util.sh -%>

foo=123
bar=<% hash_file big_data.dat %>

I'm imagining a flag for esh that allows this on the command line so I don't have to manually import utilities in each of my template files, e.g.: esh -i utils/net.sh -i utils/data.sh -o output.conf input.conf.esh. My gut is telling me there's some kind of way to do this in the shell by altering the environment or passing some flags to the shell interpreter (-s flag) without altering esh, but I can't figure it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants