20#include "parser_local_proto.h"
22static void print_python_short_flag(
FILE *
file,
const char *key,
23 const char *label,
const char *description,
25static void print_python_long_flag(
FILE *
file,
const char *key,
26 const char *label,
const char *description,
35void print_python_short_flag(
FILE *
file,
const char *key,
const char *label,
36 const char *description,
const char *
indent)
50 if (description !=
NULL) {
57void print_python_long_flag(
FILE *
file,
const char *key,
const char *label,
58 const char *description,
const char *
indent)
70 if (description !=
NULL) {
115 if (
opt->gisprompt) {
120 type =
"str | io.StringIO";
124 type =
"str | np.ndarray";
128 type =
"str | type(np.ndarray) | type(np.array) | "
129 "type(gs.array.array)";
145 if (
strcmp(type,
"str")) {
178 if (
opt->description) {
187 if (
opt->gisprompt ||
opt->key_desc) {
194 if (
opt->gisprompt) {
195 if (
strcmp(age,
"new") == 0)
197 else if (
strcmp(age,
"old") == 0)
205 if (
opt->gisprompt &&
opt->key_desc) {
225 while (
opt->opts[i]) {
231 if (
opt->gisprompt) {
232 if (
strcmp(
opt->gisprompt,
"old,colortable,colortable") ==
235 else if (
strcmp(
opt->gisprompt,
"old,barscale,barscale") ==
239 "old,northarrow,northarrow") == 0)
261 if (
opt->def &&
opt->def[0] !=
'\0') {
299 opt = &
st->first_option;
393 opt = &
st->first_option;
398 while (
opt->opts[i]) {
419 if (
flag->key ==
'g') {
450 opt = &
st->first_option;
456 if (!
opt->required && !
opt->answer) {
500 "\n%sThis grass.tools API is experimental in version 8.5 "
501 "and expected to be stable in version 8.6.\n",
517 opt = &
st->first_option;
553 print_python_long_flag(
555 _(
"Allow output files to overwrite existing files"),
indent);
560 print_python_long_flag(
file,
"verbose",
NULL,
_(
"Verbose module output"),
564 print_python_long_flag(
file,
"quiet",
NULL,
_(
"Quiet module output"),
568 print_python_long_flag(
file,
"superquiet",
NULL,
569 _(
"Very quiet module output"),
indent);
583 opt = &
st->first_option;
585 if (
opt->gisprompt) {
602 fprintf(
file,
" | np.ndarray | tuple[np.ndarray]");
607 fprintf(
file,
"If the tool produces text as standard output, a "
608 "*ToolResult* object will be returned. "
609 "Otherwise, `None` will be returned.");
611 fprintf(
file,
" If an array type (e.g., *np.ndarray*) is used for one "
612 "of the raster outputs, "
613 "the result will be an array and will have the shape "
614 "corresponding to the computational region. "
615 "If an array type is used for more than one raster "
616 "output, the result will be a tuple of arrays.");
622 "%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.