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

Shorter NODE_TAPE_OBJECT_PRINT_DEPTH env variable #534

Closed
wooorm opened this issue Dec 13, 2020 · 4 comments
Closed

Shorter NODE_TAPE_OBJECT_PRINT_DEPTH env variable #534

wooorm opened this issue Dec 13, 2020 · 4 comments

Comments

@wooorm
Copy link

wooorm commented Dec 13, 2020

A very useful feature for me is NODE_TAPE_OBJECT_PRINT_DEPTH, because I work with a lot of large JSON objects, added in #418. and #420. However, it’s a rather long name. I find myself reading the docs, CMD+F for depth, and copy pasting that line a lot because I can’t seem to remember it.

Would it be of interest to add a shorter alias for that flag? Perhaps NODE_TAPE_DEPTH or TAPE_DEPTH or so? I can make the PR.

@ljharb
Copy link
Collaborator

ljharb commented Dec 13, 2020

env vars have a high chance of conflicting, so it’s usually best if they’re long.

While this feedback may have been helpful when it was added, I’m pretty sure it’s not worth the complexity of having two env vars for the same thing - which one wins? What if they’re different? etc.

@wooorm
Copy link
Author

wooorm commented Dec 13, 2020

Yeah, understandable.
And alt idea that solves my use case is to have a different flag that presents more as “expand/inspect all”. I don‘t really care about what number the depth it set to, just that it’s very large.
That still has the problem of how the two different variables work together though.
Say, NODE_TAPE_DEEP, which when set is equivalent to 100 or so. NODE_TAPE_OBJECT_PRINT_DEPTH precedes over it. And opts.objectPrintDepth precedes over that.

@ljharb
Copy link
Collaborator

ljharb commented Dec 13, 2020

The env var is meant as a universal shortcut, that shouldn’t need to be typed often - the thing expected for common use is the depth option on each inspect call.

@wooorm
Copy link
Author

wooorm commented Dec 13, 2020

The normal behavior of tape is great. I want the normal size to be small. Just, sometimes, I need to inspect a deep and complex case. Where I can either dive into the code and add a console.dir(actual, {depth: null}) / {objectPrintDepth: 100}, but using an env variable to just print it all feels cleaner to me.

In any case, my usage seems to be an edge case so I’ll close this.

@wooorm wooorm closed this as completed Dec 13, 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

No branches or pull requests

2 participants