18#include "parser_local_proto.h"
20static void print_python_short_flag(
FILE *
file,
const char *key,
21 const char *label,
const char *description,
23static void print_python_long_flag(
FILE *
file,
const char *key,
24 const char *label,
const char *description,
33void print_python_short_flag(
FILE *
file,
const char *key,
const char *label,
34 const char *description,
const char *
indent)
48 if (description !=
NULL) {
55void print_python_long_flag(
FILE *
file,
const char *key,
const char *label,
56 const char *description,
const char *
indent)
68 if (description !=
NULL) {
113 if (
opt->gisprompt) {
118 type =
"str | io.StringIO";
122 type =
"str | np.ndarray";
126 type =
"str | type(np.ndarray) | type(np.array) | "
127 "type(gs.array.array)";
143 if (
strcmp(type,
"str")) {
176 if (
opt->description) {
185 if (
opt->gisprompt ||
opt->key_desc) {
192 if (
opt->gisprompt) {
193 if (
strcmp(age,
"new") == 0)
195 else if (
strcmp(age,
"old") == 0)
203 if (
opt->gisprompt &&
opt->key_desc) {
223 while (
opt->opts[i]) {
229 if (
opt->gisprompt) {
230 if (
strcmp(
opt->gisprompt,
"old,colortable,colortable") ==
233 else if (
strcmp(
opt->gisprompt,
"old,barscale,barscale") ==
237 "old,northarrow,northarrow") == 0)
259 if (
opt->def &&
opt->def[0] !=
'\0') {
297 opt = &
st->first_option;
391 opt = &
st->first_option;
396 while (
opt->opts[i]) {
417 if (
flag->key ==
'g') {
448 opt = &
st->first_option;
454 if (!
opt->required && !
opt->answer) {
498 "\n%sThis grass.tools API is experimental in version 8.5 "
499 "and expected to be stable in version 8.6.\n",
515 opt = &
st->first_option;
551 print_python_long_flag(
553 _(
"Allow output files to overwrite existing files"),
indent);
558 print_python_long_flag(
file,
"verbose",
NULL,
_(
"Verbose module output"),
562 print_python_long_flag(
file,
"quiet",
NULL,
_(
"Quiet module output"),
566 print_python_long_flag(
file,
"superquiet",
NULL,
567 _(
"Very quiet module output"),
indent);
581 opt = &
st->first_option;
583 if (
opt->gisprompt) {
600 fprintf(
file,
" | np.ndarray | tuple[np.ndarray]");
605 fprintf(
file,
"If the tool produces text as standard output, a "
606 "*ToolResult* object will be returned. "
607 "Otherwise, `None` will be returned.");
609 fprintf(
file,
" If an array type (e.g., *np.ndarray*) is used for one "
610 "of the raster outputs, "
611 "the result will be an array and will have the shape "
612 "corresponding to the computational region. "
613 "If an array type is used for more than one raster "
614 "output, the result will be a tuple of arrays.");
620 "%s*grass.tools.ToolError*: When the tool ended with an error.\n",
void G_free(void *)
Free allocated memory.
char ** G_tokenize(const char *, const char *)
Tokenize string.
void G_free_tokens(char **)
Free memory allocated to tokens.
char * G_strchg(char *, char, char)
Replace all occurrences of character in string bug with new.
char * G_chop(char *)
Chop leading and trailing white spaces.
char * G_store(const char *)
Copy string to allocated memory.
int G_strncasecmp(const char *, const char *, int)
String compare ignoring case (upper or lower) - limited number of characters.
int G__uses_new_gisprompt(void)
void G__split_gisprompt(const char *gisprompt, char *age, char *element, char *desc)
const struct Option * G__first_required_option_from_rules(void)
void G__md_print_escaped(FILE *f, const char *str, const char *indent)
int G__option_num_tuple_items(const struct Option *opt)
Get number of tuple items if option is a tuple.
void G__md_print_escaped_for_options(FILE *f, const char *str)
void G__md_print_python_long_version(FILE *file, const char *indent, bool tools_api)
void G__md_print_python_short_version(FILE *file, const char *indent, bool tools_api)
Structure that stores flag info.
Structure that stores option information.