Skip to content

which_r version R version choice validation #127

Closed
@iaine

Description

@iaine

When I use which_r in the devel branch on codespace and choose R, I can enter incorrect numbers without it being caught.

Screenshot 2024-06-14 at 10 32 11

I would expect if choosing a value higher than the environments to have a warning. Maybe a simple add an else to the blocks in lines 36 - 40:
'''
if [[ ! "$choice" =~ ^[1-9]$ ]]; then
echo "Invalid choice. Please enter a number between 1 and $(($counter - 1))"
exit 1
elif [[ "$choice" > $counter ]]; then
echo "Invalid choice. Please enter a number between 1 and $(($counter - 1))"
exit 1
fi
'''
?

Otherwise the script returns with a path to an R` that does not exist.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions