Test settings to stdout or clipboard.

This commit is contained in:
Erik Moqvist
2026-07-03 13:15:02 +02:00
parent 0ad2e5203c
commit 7d7156ff24
3 changed files with 20 additions and 5 deletions
+5 -1
View File
@@ -79,10 +79,14 @@ test:
mkdir -p files && \
python main.py config.toml $(TEST_ARGS)
test-generate-device-settings:
test-generate-device-settings-clipboard:
cd test && \
python generate_device_settings.py config.toml
test-generate-device-settings-stdout:
@cd test && \
python generate_device_settings.py --force-stdout config.toml
machine-translate:
python utils/translate.py Common/Localizable.xcstrings
+11 -1
View File
@@ -11,12 +11,22 @@ brew install qrtool
# Moblin device configuration
## Via clipboard
1. Generate settings into clipboard.
```bash
make -C .. test-generate-device-settings
make -C .. test-generate-device-settings-clipboard
```
2. Import the generated settings from clipboard into Moblin.
## Via standard output
1. Generate settings to standard output.
```bash
make -C .. test-generate-device-settings-stdout
```
2. Import the generated settings somehow.
# Run the tests
```bash
+4 -3
View File
@@ -153,16 +153,17 @@ def create_settings(config):
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--force-stdout", action="store_true")
parser.add_argument("config_toml", type=Path)
args = parser.parse_args()
config = tomllib.loads(args.config_toml.read_text())
settings = create_settings(config)
settings = json.dumps(settings, indent=4)
try:
if args.force_stdout:
print(settings)
else:
pyperclip.copy(settings)
print("Settings copied to clipboard.")
except pyperclip.PyperclipException:
print(settings)
main()