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

Feature/variable interpolation #45

Merged
merged 2 commits into from
Sep 3, 2020

Conversation

jenpet
Copy link
Contributor

@jenpet jenpet commented Sep 2, 2020

Addressing discussed issue #44 and a bug which did not allow to prompt variables when there is a variable on root level or on levels higher than two.

@jenpet
Copy link
Contributor Author

jenpet commented Sep 2, 2020

@yields maybe you want to have a look at it. I extracted all of the interpolation relevant stuff into a new interpolation package which has the responsibility to interpolate tasks and the variables section.

@yields yields self-requested a review September 2, 2020 11:46
Copy link
Collaborator

@yields yields left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful, I really like that new shell invocation feature, so useful :)

I left two comments, otherwise this looks great!

interpolation/interpolation.go Show resolved Hide resolved

// captureCommandOutput executes a command and captures the output which usually gets prompted to stdout.
func captureCommandOutput(args string) (string, error) {
cmd := exec.Command("sh", "-c", args)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we default to the user's active shell?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used $SHELL to find a user's active shell and as a fallback it will be still sh. Might do the trick, what do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds great to me :)

@jenpet
Copy link
Contributor Author

jenpet commented Sep 2, 2020

I made a separate commit with the work due to review findings but I will squash them into the previous one(s) as soon as you're happy with it so we have a clean history :-)

@yields yields self-requested a review September 2, 2020 16:00
Copy link
Collaborator

@yields yields left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! thanks for the contribution, I'll wait for you to squash before I merge and release.

Jens Petersohn added 2 commits September 2, 2020 18:06
…olation.

A variable in the variables section can now reference another variable and will get populated before an actual task’s content will get populated. Additionally to self-referencing variables `$()` will run a command and capture the output into a variable.
…he variables section on the root level and on levels higher than level two.
@jenpet jenpet force-pushed the feature/variable_interpolation branch from 2072015 to eb1f1bb Compare September 2, 2020 16:08
@jenpet
Copy link
Contributor Author

jenpet commented Sep 2, 2020

Sweet :-). I'm done so far. I got more ideas which might be useful. I'd just open a ticket for them at some point in time and create pull requests if you guys are happy with the approaches.

Thanks for releasing!

@yields yields merged commit bb4ca22 into tj:master Sep 3, 2020
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.

None yet

2 participants