File: args.c

package info (click to toggle)
grass 8.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 277,040 kB
  • sloc: ansic: 460,798; python: 227,732; cpp: 42,026; sh: 11,262; makefile: 7,007; xml: 3,637; sql: 968; lex: 520; javascript: 484; yacc: 450; asm: 387; perl: 157; sed: 25; objc: 6; ruby: 4
file content (84 lines) | stat: -rw-r--r-- 3,165 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <stdlib.h>

#include <grass/gis.h>
#include <grass/glocale.h>

#include "local_proto.h"

void parse_args(int argc, char **argv, struct _options *options,
                struct _flags *flags)
{
    options->dsn = G_define_option();
    options->dsn->key = "input";
    options->dsn->type = TYPE_STRING;
    options->dsn->label = _("Name of input OGR or PostGIS data source");
    options->dsn->description =
        _("Examples:\n"
          "\t\tESRI Shapefile: directory containing a shapefile\n"
          "\t\tMapInfo File: directory containing a mapinfo file\n"
          "\t\tPostGIS database: connection string, eg. 'PG:dbname=db "
          "user=grass'");
    options->dsn->required = YES;
    options->dsn->gisprompt = "old,datasource,datasource";

    options->layer = G_define_option();
    options->layer->key = "layer";
    options->layer->type = TYPE_STRING;
    options->layer->required = NO;
    options->layer->multiple = NO;
    options->layer->label =
        _("Name of OGR layer or PostGIS feature table to be linked");
    options->layer->description = _("Examples:\n"
                                    "\t\tESRI Shapefile: shapefile name\n"
                                    "\t\tMapInfo File: mapinfo file name\n"
                                    "\t\tPostGIS database: table name");
    options->layer->required = NO;
    options->layer->key_desc = "name";
    options->layer->gisprompt = "old,datasource_layer,datasource_layer";

    options->where = G_define_standard_option(G_OPT_DB_WHERE);

    options->output = G_define_standard_option(G_OPT_V_OUTPUT);
    options->output->required = NO;
    options->output->description =
        _("Name for output GRASS vector map (default: input layer)");

    flags->override = G_define_flag();
    flags->override->key = 'o';
    flags->override->label =
        _("Override projection check (use current project's CRS)");
    flags->override->description =
        _("Assume that the dataset has the same "
          "coordinate reference system as the current project");

    flags->proj = G_define_flag();
    flags->proj->key = 'j';
    flags->proj->description = _("Perform projection check only and exit");

    flags->format = G_define_flag();
    flags->format->key = 'f';
    flags->format->description = _("List supported formats and exit");
    flags->format->guisection = _("Print");
    flags->format->suppress_required = YES;

    flags->list = G_define_flag();
    flags->list->key = 'l';
    flags->list->description =
        _("List available layers in data source and exit");
    flags->list->guisection = _("Print");
    flags->list->suppress_required = YES;

    flags->tlist = G_define_flag();
    flags->tlist->key = 't';
    flags->tlist->label = _("List available layers including feature type "
                            "in data source and exit");
    flags->tlist->description =
        _("Format: layer name,type,projection check,geometry");
    flags->tlist->guisection = _("Print");
    flags->tlist->suppress_required = YES;

    flags->topo = G_define_standard_flag(G_FLG_V_TOPO);

    if (G_parser(argc, argv))
        exit(EXIT_FAILURE);
}