Skip to content

Improved python tool support #673

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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)"

# Si nvm no está instalado, utilizar "njs"
val_py="py $val_py"
if _omb_util_command_exists uv; then
val_py="uv($val_uv) $val_py$val_venv"
Copy link
Contributor

Choose a reason for hiding this comment

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

The values of val_uv and val_venv are only used inside this if-branch. The values of these variables should be calculated inside this branch.

Comment on lines 68 to +69
else
# Si nvm no está instalado, utilizar "njs"
val_py="py $val_py"
if _omb_util_command_exists uv; then
Copy link
Contributor

Choose a reason for hiding this comment

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

This else and if can be combined to elif.

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