ajmaradiaga / devtoberfest2023-validator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenAPI Generated README

This README and script are generated by an OpenAPI tool. The script retrieves and matches badges earned during the Devtoberfest 2023 event.

Script Summary

The provided script is a Bash script that performs the following steps:

  1. Checks if the "pup" command is available. If not found, it tries to install pup using Homebrew (brew). If Homebrew is not available, it displays an error message with instructions to install pup manually from the official repository.

  2. Initializes the userInput variable.

  3. Processes command-line options. The script accepts a single option -u to provide the userInput value.

  4. If no userInput value is provided, the script prompts the user to enter a scnId.

  5. Sends a GET request to retrieve badge information from the SAP People API based on the provided or user-input scnId. The response is stored in the response variable.

  6. Extracts the badge names from the JSON response using the jq tool. It filters for badges that contain the phrase "- Devtoberfest 2023 -" and extracts their display names. The extracted badges are stored in the badges variable.

  7. Sends a GET request to retrieve the Week 1 activities and points from a SAP Community blog post related to Devtoberfest 2023. The HTML content of the page is stored in the week1 variable.

  8. Uses the pup command to extract the HTML table cell contents from the second column of the table on the page. The extracted HTML is stored in the table_html variable.

  9. Converts the HTML content to JSON format using jq.

  10. Extracts the badge names from the JSON using jq, filtering for entries starting with "#" to match the format of badge names.

  11. Compares the extracted Week 1 badges with the obtained badges to determine which badges have been earned.

  12. Displays the matching badges with a "✅" symbol and non-matching badges with an "❌" symbol.

Prerequisites

  • The script requires the "pup" command to be installed. If not found, the script attempts to install it using Homebrew.
  • If Homebrew is not available, manual installation of "pup" is required by following the instructions from the official GitHub repository: https://github.com/ericchiang/pup

Usage

To use the script, execute it with the following command:

bash <script_name>.sh [-u ]

Command-line options:

  • -u <scnId>: Specifies the scnId to retrieve the badges. If not provided, the script will prompt for input.

Example

bash devtoberfest.sh -u john_doe
or
bash devtoberfest.sh
Enter a scnId: john_doe
Output
The script will output a list of badges earned for Week 1 of Devtoberfest 2023. The badges will be prefixed with a "" symbol if they have been earned and an "" symbol if they haven't.
Example output:
✅ #Badge1
❌ #Badge2
✅ #Badge3

Please note that the script is specifically tailored for the Devtoberfest 2023 event and may not work as expected for other scenarios or events.

This README and script were generated by an OpenAPI tool and should be used in conjunction with its generated code. Any modifications made to this file may be overwritten by future code regenerations.

About


Languages

Language:Shell 100.0%