|
2 | 2 | Console script for compas_fea2.
|
3 | 3 | """
|
4 | 4 |
|
5 |
| -import json |
| 5 | +import importlib |
6 | 6 | import os
|
7 | 7 | import sys
|
8 | 8 |
|
9 | 9 | import click
|
10 |
| -import importlib |
11 | 10 | import dotenv
|
12 | 11 |
|
13 |
| -from compas_fea2 import HOME, VERBOSE |
| 12 | +from compas_fea2 import HOME |
| 13 | +from compas_fea2 import VERBOSE |
14 | 14 |
|
15 | 15 | try:
|
16 | 16 | from fea2_extension.main import init_plugin # type: ignore
|
@@ -54,21 +54,22 @@ def init_backend(backend, clean):
|
54 | 54 | @click.argument("value")
|
55 | 55 | def change_setting(backend, setting, value):
|
56 | 56 | """Change a setting for the specified backend.\n
|
57 |
| - backend : txt\n |
58 |
| - The name of the backend. |
59 |
| - setting : txt\n |
60 |
| - The setting to be changed. |
61 |
| - value : txt\n |
62 |
| - The new value for the setting. |
63 |
| -
|
64 |
| -Example usage:\n |
65 |
| - fea2 change-setting opensees exe "Applications/OpenSees3.5.0/bin/OpenSees" |
| 57 | + backend : txt\n |
| 58 | + The name of the backend. |
| 59 | + setting : txt\n |
| 60 | + The setting to be changed. |
| 61 | + value : txt\n |
| 62 | + The new value for the setting. |
| 63 | +
|
| 64 | + Example usage:\n |
| 65 | + fea2 change-setting opensees exe "Applications/OpenSees3.5.0/bin/OpenSees" |
66 | 66 | """
|
67 |
| - m = importlib.import_module("compas_fea2_"+backend.lower()) |
68 |
| - env = os.path.join(m.HOME,"src", "compas_fea2_"+backend.lower(),".env") |
| 67 | + m = importlib.import_module("compas_fea2_" + backend.lower()) |
| 68 | + env = os.path.join(m.HOME, "src", "compas_fea2_" + backend.lower(), ".env") |
69 | 69 | dotenv.set_key(env, setting.upper(), value)
|
70 | 70 | print(f"{setting.upper()} set to {value} for compas_fea2_{backend.lower()}")
|
71 | 71 |
|
| 72 | + |
72 | 73 | # -------------------------------- DEBUG ----------------------------------#
|
73 | 74 | if __name__ == "__main__":
|
74 | 75 | sys.exit(main.init_backend())
|
0 commit comments