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

theme set command should give error when index isn't provided #2

Open
pastly opened this issue Jun 9, 2019 · 2 comments
Open

theme set command should give error when index isn't provided #2

pastly opened this issue Jun 9, 2019 · 2 comments

Comments

@pastly
Copy link
Owner

pastly commented Jun 9, 2019

./bm theme set terminal should provide an error message about how you should be using an index instead of a theme name. The correct command is ./bm theme set 2 (or similar).

@pastly
Copy link
Owner Author

pastly commented Jun 9, 2019

Adding the following isn't good enough because while it handles ./bm theme set 9999 correctly, it doesn't handle ./bm theme set terminal correctly.

[[ "${THEMES[$2]}" == "" ]] &&
	echo "'$2' is not a valid theme index. Try ./bm list" &&
	exit 1

@pastly
Copy link
Owner Author

pastly commented Jul 8, 2019

A regex to check if the index is a valid int would do it, I think. https://stackoverflow.com/questions/806906/how-do-i-test-if-a-variable-is-a-number-in-bash

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

1 participant