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

${default} not interpolated into help if using vars #337

Open
mitar opened this issue Oct 9, 2022 · 3 comments
Open

${default} not interpolated into help if using vars #337

mitar opened this issue Oct 9, 2022 · 3 comments

Comments

@mitar
Copy link
Contributor

mitar commented Oct 9, 2022

type cli struct {
  Config string `type:"path" default:"${config_file}" help:"Default: ${default}"`
}

func main() {
  kong.Parse(&cli,
    kong.Vars{
      "config_file": "~/.app.conf",
    })
}

This prints in help Default: ${config_file} and not Default: ~/.app.conf.

@alecthomas alecthomas changed the title Default not interpolated if using vars default not interpolated into help if using vars Oct 9, 2022
@alecthomas alecthomas changed the title default not interpolated into help if using vars ${default} not interpolated into help if using vars Oct 9, 2022
@alecthomas
Copy link
Owner

alecthomas commented Oct 9, 2022

I think what will need to happen is that Kong should iteratively resolve variables until none remain unresolved.

@mitar
Copy link
Contributor Author

mitar commented Oct 9, 2022

Or just first interpolate default, and then interpolate help?

@alecthomas
Copy link
Owner

That won't solve interpolation ordering issues on other fields. For example, enum would have the same issue.

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

2 participants