Skip to content

Conversation

@marco-gallegos
Copy link
Contributor

just a small update :)

Comment on lines 61 to 62
if [[ -n "$VIRTUAL_ENV" ]]; then
val_venv=" ($(echo "$VIRTUAL_ENV" | awk -F/ '{print $(NF-1)"/"$NF}'))"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering what happens when VIRTUAL_ENV contains a newline in the path. The above would output multiple aaa/bbb pairs. Also, what happens when VIRTUAL_ENV doesn't contain any /? It would output / + $VIRTUAL_ENV, but I'm not sure if it's the intended behavior. I'd suggest simply doing

Suggested change
if [[ -n "$VIRTUAL_ENV" ]]; then
val_venv=" ($(echo "$VIRTUAL_ENV" | awk -F/ '{print $(NF-1)"/"$NF}'))"
if [[ $VIRTUAL_ENV =~ [^/]+/[^/]+$ ]]; then
val_venv=" ($BASH_REMATCH)"

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, what happens when VIRTUAL_ENV doesn't contain any /?

This hasn't been answered. Or is it ensured that it VIRTUAL_ENV contains /?

@marco-gallegos
Copy link
Contributor Author

Thank you about your review @akinomyoga I just pushed these changes to my branch

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.

2 participants