You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: allow passing strings to the converter from the terminal (#3679)
* feat: allow passing raw strings to the converter
* chore: adding changelog file 3679.miscellaneous.md [dependabot-skip]
* refactor: using click options to avoid having to set the files manual. Better behavior. Adding short options. Improved tests
* chore: adding changelog file 3679.documentation.md [dependabot-skip]
* chore: adding changelog file 3679.documentation.md [dependabot-skip]
* fix: removing unused variables.
* fix: test
* fix: test
* test: skip test if click is not available.
---------
Co-authored-by: pyansys-ci-bot <[email protected]>
@click.option("-o", default=None, help="Name of the output Python script.")
69
-
@click.option("--filename_out", default=None, help="Name of the output Python script.")
70
81
@click.option(
71
82
"--loglevel",
83
+
"-ll",
72
84
default="WARNING",
73
85
help="Logging level of the ansys object within the script.",
74
86
)
75
87
@click.option(
76
88
"--auto_exit",
89
+
"-ae",
77
90
default=True,
78
91
type=bool,
79
92
help="Adds a line to the end of the script to exit MAPDL. Default ``True``",
80
93
)
81
94
@click.option(
82
-
"--line_ending", type=bool, default=None, help="When None, automatically is ``\n.``"
95
+
"--line_ending",
96
+
"-le",
97
+
type=str,
98
+
default=None,
99
+
help="When None, automatically is ``\n.``",
83
100
)
84
101
@click.option(
85
102
"--exec_file",
103
+
"-e",
86
104
default=None,
87
105
type=str,
88
106
help="Specify the location of the ANSYS executable and include it in the converter output ``launch_mapdl`` call.",
89
107
)
90
108
@click.option(
91
109
"--macros_as_functions",
110
+
"-mf",
92
111
default=True,
93
112
type=bool,
94
113
help="Attempt to convert MAPDL macros to python functions.",
95
114
)
96
115
@click.option(
97
116
"--use_function_names",
117
+
"-fn",
98
118
default=True,
99
119
type=bool,
100
120
help="Convert MAPDL functions to ansys.mapdl.core.Mapdl class methods. When ``True``, the MAPDL command ``K`` will be converted to ``mapdl.k``. When ``False``, it will be converted to ``mapdl.run('k')``.",
101
121
)
102
122
@click.option(
103
123
"--show_log",
124
+
"-sl",
104
125
default=False,
105
126
type=bool,
106
127
help="Print the converted commands using a logger (from ``logging`` Python module).",
107
128
)
108
129
@click.option(
109
130
"--add_imports",
131
+
"-ai",
110
132
default=True,
111
133
type=bool,
112
134
help='If ``True``, add the lines ``from ansys.mapdl.core import launch_mapdl`` and ``mapdl = launch_mapdl(loglevel="WARNING")`` to the beginning of the output file. This option is useful if you are planning to use the output script from another mapdl session. See examples section. This option overrides ``auto_exit``.',
113
135
)
114
136
@click.option(
115
137
"--comment_solve",
138
+
"-cs",
116
139
default=False,
117
140
type=bool,
118
141
help='If ``True``, it will pythonically comment the lines that contain ``"SOLVE"`` or ``"/EOF"``.',
119
142
)
120
143
@click.option(
121
144
"--cleanup_output",
145
+
"-co",
122
146
default=True,
123
147
type=bool,
124
148
help="If ``True`` the output is formatted using ``autopep8`` before writing the file or returning the string. This requires ``autopep8`` to be installed.",
125
149
)
126
150
@click.option(
127
151
"--header",
152
+
"-h",
128
153
default=True,
129
154
help="If ``True``, the default header is written in the first line of the output. If a string is provided, this string will be used as header.",
130
155
)
131
156
@click.option(
132
157
"--print_com",
158
+
"-pc",
133
159
default=True,
134
160
type=bool,
135
161
help="Print command ``/COM`` arguments to python console. Defaults to ``True``.",
136
162
)
137
163
@click.option(
138
164
"--only_commands",
165
+
"-oc",
139
166
default=False,
167
+
is_flag=True,
168
+
flag_value=True,
140
169
type=bool,
141
170
help="""If ``True``, it converts only the commands, meaning that header
0 commit comments