This README and script are generated by an OpenAPI tool. The script retrieves and matches badges earned during the Devtoberfest 2023 event.
The provided script is a Bash script that performs the following steps:
-
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.
-
Initializes the
userInput
variable. -
Processes command-line options. The script accepts a single option
-u
to provide theuserInput
value. -
If no
userInput
value is provided, the script prompts the user to enter ascnId
. -
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 theresponse
variable. -
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 thebadges
variable. -
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. -
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 thetable_html
variable. -
Converts the HTML content to JSON format using
jq
. -
Extracts the badge names from the JSON using
jq
, filtering for entries starting with "#" to match the format of badge names. -
Compares the extracted Week 1 badges with the obtained badges to determine which badges have been earned.
-
Displays the matching badges with a "✅" symbol and non-matching badges with an "❌" symbol.
- 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
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.
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.