Skip to content

Conversation

@technic960183
Copy link
Member

Summary

Provide a bash script access for the configuration settings introduced in #383 .

Rationale

  • Enables consistent and scriptable access to configuration setting values
  • Simplifies Python-side logic
  • Keeps behavior unchanged for existing tools (set_settings.sh)

Changes

Refactored Common Settings Utilities in set_settings.sh to settings.sh

Extracted key definitions and utility functions from set_settings.sh into a new file: tool/config/settings.sh
set_settings.sh updated to source settings.sh.

  • Shared Variables: KEY_DESCRIPTIONS, VALID_KEYS, MAX_KEY_LENGTH
  • Shared Utility functions: print_key(), show_valid_keys()

New Script: get_settings.sh

Added tool/config/get_settings.sh to retrieve a single key’s value from the settings.

Supports:

  • --local, --global flags for scope control
  • When neither is specified, try local first, then global.
  • Output is machine-friendly (just the value), designed for use in other scripts or tools
  • Also source settings.sh

Replaced Old Python Logic with the New Interface

Removed the old SystemSetting class in configure.py.

Added new function:

def get_setting(key, default_val=None)

Calls get_settings.sh directly and returns the setting value or default_val if not set.
Simplifies and unifies how Python retrieves config setting values using the same logic as the shell tools.

Tests

  • set_settings.sh works the same as before.
  • get_settings.sh could retrieve the values in the correct order.
  • configure.py can read the default machine as before.

The logic of `SystemSetting` is moved to the script `get_settings.sh`.
And `get_setting()` is added to call this script and return the result.
@hyschive hyschive requested a review from ChunYen-Chen July 17, 2025 14:12
@hyschive hyschive added enhancement general General issues and improvement labels Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement general General issues and improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants