Skip to content

Add input validation for year, round, and institute type selections in CLI#62

Merged
ksauraj merged 2 commits intoksauraj:masterfrom
sparshsinghal885:feat/validation
Oct 2, 2025
Merged

Add input validation for year, round, and institute type selections in CLI#62
ksauraj merged 2 commits intoksauraj:masterfrom
sparshsinghal885:feat/validation

Conversation

@sparshsinghal885
Copy link
Contributor

What this PR does:

  • Refactors the following functions to validate user input and prevent invalid selections:
    1. josaa_rounds_year()
    2. josaa_rounds()
    3. csab_rounds_year()
    4. csab_rounds()
    5. csab_institute_types()
    6. josaa_institute_types()

Improvements:

  • Uses while-loops instead of recursion to handle invalid input.
  • Prints clear error messages when the user enters invalid options.
  • Ensures variables are always assigned before proceeding.
  • Prevents runtime errors such as UnboundLocalError.
  • Makes the CLI more user-friendly and robust.

How to Test:

  1. Run the CLI tool.
  2. Enter invalid inputs for year, round, and institute type selections.
  3. Confirm that the tool keeps prompting until a valid option is entered.
  4. Confirm that valid selections proceed as expected.

@ksauraj ksauraj added enhancement New feature or request approved ✅ PR approved by maintainer. hacktoberfest hacktoberfest2025 labels Oct 2, 2025
@ksauraj
Copy link
Owner

ksauraj commented Oct 2, 2025

LGTM, thanks @sparshsinghal885

@ksauraj ksauraj merged commit 84036e1 into ksauraj:master Oct 2, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved ✅ PR approved by maintainer. enhancement New feature or request hacktoberfest hacktoberfest2025

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants