GameServerManagers / LinuxGSM

The command-line tool for quick, simple deployment and management of Linux dedicated game servers.
https://linuxgsm.com
MIT License
4.18k stars 801 forks source link

feat(dev): add new developer command for parsing distro details #4523

Closed MicLieg closed 3 months ago

MicLieg commented 4 months ago

Description

Parse Game Details

Parse Distro Details

Fixes N/A

Type of change

Checklist

PR will not be merged until all steps are complete.

Documentation

If documentation does need updating either update it by creating a PR (preferred) or request a documentation update.

Thank you for your Pull Request!

MicLieg commented 3 months ago

You're absolutley right! I didn't think of that.

I'll submit a PR for the docs in a couple of hours tomorrow 👍

MicLieg commented 3 months ago

FYI, I'm going to keep the new documentation for this to a minimum for now, and expand it as soon as https://github.com/GameServerManagers/LinuxGSM/pull/4527 and the other two doc PRs are merged.

After that i'm planning to give all the docs some attention and will be refactoring them quite a bit.

MicLieg commented 1 week ago

This comment was posted to the wrong PR:

For archiving purposes, I'm posting the script I used to extract most of the variables:

#!/bin/bash

# Define the root directory to search in
ROOT_DIR="./lgsm/modules"

# Find all .sh files and process them
find "$ROOT_DIR" -type f -name "*.sh" | while read -r file; do
    echo "File: $file"
    # Extract variables, including those using += for appending
    # Remove duplicates in the same file, ignoring comments
    # and focusing on simple VARIABLE=value or VARIABLE+=value patterns
    # without the value, =, or + character
    grep -Eo '^[[:space:]]*[^#[:space:]]+\+?=[^=]+' "$file" | \
    sed -E 's/\+?=.*//' | \
    sort | uniq | \
    sort | \
    while read -r variable; do
        echo "  - $variable"
    done
    echo # Add a blank line for better readability between files
done