17#include "parser_local_proto.h"
27 fprintf(fp,
"#!/usr/bin/env python3\n");
28 fprintf(fp,
"##############################################################"
36 fprintf(fp,
"# SPDX-FileCopyrightText: GRASS Development Team\n");
37 fprintf(fp,
"# SPDX-License-Identifier: GPL-2.0-or-later\n");
39 fprintf(fp,
"##############################################################"
40 "##############\n\n");
42 fprintf(fp,
"\"\"\"Wraps %s to make it even better\"\"\"\n\n",
46 if (
st->module_info.label)
47 fprintf(fp,
"# %% label: %s\n",
st->module_info.label);
48 if (
st->module_info.description)
49 fprintf(fp,
"# %% description: %s\n",
st->module_info.description);
50 if (
st->module_info.keywords) {
53 for (i = 0; i <
st->n_keys; i++) {
54 fprintf(fp,
"# %% keyword: %s\n",
st->module_info.keywords[i]);
65 if (
flag->suppress_required)
66 fprintf(fp,
"# %% suppress_required: yes\n");
69 if (
flag->description)
70 fprintf(fp,
"# %% description: %s\n",
flag->description);
72 fprintf(fp,
"# %% guisection: %s\n",
flag->guisection);
99 fprintf(fp,
"# %% required: %s\n",
opt->required ?
"yes" :
"no");
100 fprintf(fp,
"# %% multiple: %s\n",
opt->multiple ?
"yes" :
"no");
102 fprintf(fp,
"# %% options: %s\n",
opt->options);
104 fprintf(fp,
"# %% key_desc: %s\n",
opt->key_desc);
107 if (
opt->description)
108 fprintf(fp,
"# %% description: %s\n",
opt->description);
109 if (
opt->descriptions)
110 fprintf(fp,
"# %% descriptions: %s\n",
opt->descriptions);
112 fprintf(fp,
"# %% answer: %s\n",
opt->answer);
114 fprintf(fp,
"# %% gisprompt: %s\n",
opt->gisprompt);
116 fprintf(fp,
"# %% guisection: %s\n",
opt->guisection);
117 if (
opt->guidependency)
118 fprintf(fp,
"# %% guidependency: %s\n",
opt->guidependency);
123 fprintf(fp,
"\nimport grass.script as gs\n\n");
127 "\n \"\"\"Process command line parameters and run analysis\"\"\"");
128 fprintf(fp,
"\n options, flags = gs.parser()");
129 fprintf(fp,
"\n # Put your code here.");
131 fprintf(fp,
"\nif __name__ == \"__main__\":");
const char * G_program_name(void)
Return module name.
const char * G_whoami(void)
Gets user's name.
void G__script(void)
Generate Python script-like output.
Structure that stores flag info.
Structure that stores option information.