Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

gb env should return value associated with a variable #476

Closed
gosuri opened this issue Dec 8, 2015 · 8 comments
Closed

gb env should return value associated with a variable #476

gosuri opened this issue Dec 8, 2015 · 8 comments

Comments

@gosuri
Copy link
Contributor

gosuri commented Dec 8, 2015

A cool enhancement that'll make gb env more script friendly would be to return the assigned value for a var, similar to go env VAR. Example:

$ gb env GB_PROJECT_DIR
/Users/gosuri/code/walker

I can send a patch, if you'd like.

@davecheney
Copy link
Contributor

👍 from me. You'll probably have to do some serious surgery to replace the simplistic way gb info works now.

Alternatively you may want to add a gb env, or make gb env an alias for gb info.

Either way, please make sure you add end to end tests to cmd/gb/gb_test.go.

Thanks

Dave

@gosuri
Copy link
Contributor Author

gosuri commented Dec 8, 2015

Awesome! Will get rolling.

@gosuri
Copy link
Contributor Author

gosuri commented Dec 8, 2015

I see what you meant by "serious surgery", the args are pkg paths :)

Then I discovered cmd.ParseArgs

gosuri pushed a commit to gosuri/gb that referenced this issue Dec 8, 2015
`gb info` optionally accepts a list of environment variable names and
returns their values. `gb env` is aliased to gb info.

Updates constabulary#476
@davecheney
Copy link
Contributor

I believe there is an option to override arg parsing per command. Have a
look at the cmd.Cmd structure and check out how test monkeys with argument
parsing.

On Wed, 9 Dec 2015, 08:50 Greg Osuri notifications@github.com wrote:

I see what you meant by "serious surgery", the args are pkg paths :)


Reply to this email directly or view it on GitHub
#476 (comment).

@gosuri
Copy link
Contributor Author

gosuri commented Dec 8, 2015

Thanks.. Figured it out

@davecheney
Copy link
Contributor

Sorry its such a hand rolled mess.

Part of the challenge with gb is I've made such a song and dance about how
package management should be done, I've sort of painted myself into a
corner and made myself unable to use third party packages.

I should probably find a ladder and get down off my high horse.

On Wed, 9 Dec 2015, 10:23 Greg Osuri notifications@github.com wrote:

Thanks.. Figured it out


Reply to this email directly or view it on GitHub
#476 (comment).

@gosuri
Copy link
Contributor Author

gosuri commented Dec 8, 2015

I sort of jumped straight to the command's code under the assumption that args weren't manipulated. It wasn't hard tracing back. The code and tests were clear and easy to understand.

More over, I learned much more about the tool with this exercise. Will come handy since I'll be using gb everyday.

@davecheney
Copy link
Contributor

closed by #477

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

No branches or pull requests

2 participants