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

How do I access Helpers from Prompts? #410

Closed
ajoslin103 opened this issue Sep 20, 2022 · 1 comment
Closed

How do I access Helpers from Prompts? #410

ajoslin103 opened this issue Sep 20, 2022 · 1 comment

Comments

@ajoslin103
Copy link

I want to only ask for inputs if I don't already have them

const h = require('hygen/helpers') // <===== Error: Cannot find module 'hygen/helpers'
module.exports = [
  {
    type: 'input',
    name: 'dev_email',
    message: "Please enter your dev_email prior to the @ symbol, which Kubernetes doesn't allow in string fields:",
    skip: () => h.isLocal('dev_email')
  },

Of course that would mean that helpers had access to local variables defined within the hygen execution

const locals = require('hygen/locals') // <===== Error: Cannot find module 'hygen/locals'
module.exports = {
    helpers: {
        isLocal: tag => !!locals[tag]
    }
}

How to I access the execution space of the interpolater? It has all the data I need?

@ajoslin103
Copy link
Author

ajoslin103 commented Sep 26, 2022

this is mostly answered here: https://www.hygen.io/docs/generators#advanced-interactive-prompt

some additional details can be found here: #35 (comment)

my use case was satisfied, thanks for a great tool 👍

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

1 participant