mirror of
https://github.com/eerimoq/moblin.git
synced 2026-07-04 15:06:48 +00:00
Test settings to stdout or clipboard.
This commit is contained in:
@@ -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
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user