dashboard.sh)The dashboard.sh script is the main entry point for the application. It serves as an orchestrator, responsible for parsing arguments, loading configuration, and running modules for data collection, or running overviews for data analysis.
To collect data from modules:
./dashboard.sh [options] [module]
To run an overview:
./dashboard.sh -o <overview_name> [overview_options]
-f, --format <format>: (For module runs only) Specify the output format. See Output Formats for a full list of supported formats. If not provided, the default is tsv.-o, --overview <name>: Run a specific overview from the overviews/ directory. Any subsequent arguments will be passed to the overview script.-v, --verbose: Enable verbose (debug) mode, which prints detailed messages about the script’s execution to standard error.-h, --help: Display a help message with usage information and exit.[module]: (Optional, for module runs only) The name of a single module to run (e.g., github, hackernews). If a module name is provided, only that module’s data will be collected. If omitted, the script will run all executable modules found in the modules/ directory.The script has two main modes of operation: data collection and reporting.
This is the default mode when the -o flag is not used.
Argument Parsing: It parses command-line options (-f, -h) and an optional module name.
Configuration Loading: It checks for the existence of config/config.sh. If the file is not found, it will print an error message and exit. If found, it will source the file to load all the user-defined variables into the script’s environment.
Dependency Check: It verifies that the required command-line tools, curl and jq, are installed and available in the system’s PATH.
modules/ directory and runs them one by one.json, xml, and html, it wraps the collected outputs with the appropriate root elements. For simpler formats like plain or csv, it concatenates the outputs. The final report is printed to standard output, which can be redirected to a file.This mode is triggered by the -o flag.
Argument Parsing: The script looks for the -o flag. When found, it takes the next argument as the overview’s name. All following arguments are passed directly to the overview.
Overview Execution: The script looks for an executable file with the given name in the overviews/ directory and runs it, passing along any overview-specific arguments. The output of the overview is printed to standard output.