| 27 | /************************************************************************/ |
| 28 | |
| 29 | GDALVectorInfoAlgorithm::GDALVectorInfoAlgorithm(bool standaloneStep) |
| 30 | : GDALVectorPipelineStepAlgorithm(NAME, DESCRIPTION, HELP_URL, |
| 31 | ConstructorOptions() |
| 32 | .SetStandaloneStep(standaloneStep) |
| 33 | .SetInputDatasetMaxCount(1) |
| 34 | .SetAddDefaultArguments(false)) |
| 35 | { |
| 36 | AddOutputFormatArg(&m_format).SetChoices("json", "text"); |
| 37 | AddOpenOptionsArg(&m_openOptions).SetHiddenForCLI(!standaloneStep); |
| 38 | AddInputFormatsArg(&m_inputFormats) |
| 39 | .AddMetadataItem(GAAMDI_REQUIRED_CAPABILITIES, {GDAL_DCAP_VECTOR}) |
| 40 | .SetHiddenForCLI(!standaloneStep); |
| 41 | |
| 42 | auto &datasetArg = |
| 43 | AddInputDatasetArg(&m_inputDataset, GDAL_OF_VECTOR).AddAlias("dataset"); |
| 44 | if (!standaloneStep) |
| 45 | datasetArg.SetHidden(); |
| 46 | auto &layerArg = AddLayerNameArg(&m_layerNames) |
| 47 | .SetMutualExclusionGroup("layer-sql") |
| 48 | .AddAlias("layer"); |
| 49 | SetAutoCompleteFunctionForLayerName(layerArg, datasetArg); |
| 50 | auto &argFeature = |
| 51 | AddArg( |
| 52 | "features", 0, |
| 53 | _("List all features (beware of RAM consumption on large layers)"), |
| 54 | &m_listFeatures) |
| 55 | .SetMutualExclusionGroup("summary-features"); |
| 56 | AddArg("summary", 0, _("List the layer names and the geometry type"), |
| 57 | &m_summaryOnly) |
| 58 | .SetMutualExclusionGroup("summary-features"); |
| 59 | AddArg("limit", 0, |
| 60 | _("Limit the number of features per layer (implies --features)"), |
| 61 | &m_limit) |
| 62 | .SetMinValueIncluded(0) |
| 63 | .SetMetaVar("FEATURE-COUNT") |
| 64 | .AddAction([&argFeature]() { argFeature.Set(true); }); |
| 65 | AddArg("sql", 0, |
| 66 | _("Execute the indicated SQL statement and return the result"), |
| 67 | &m_sql) |
| 68 | .SetReadFromFileAtSyntaxAllowed() |
| 69 | .SetMetaVar("<statement>|@<filename>") |
| 70 | .SetRemoveSQLCommentsEnabled() |
| 71 | .SetMutualExclusionGroup("layer-sql"); |
| 72 | AddArg("where", 0, |
| 73 | _("Attribute query in a restricted form of the queries used in the " |
| 74 | "SQL WHERE statement"), |
| 75 | &m_where) |
| 76 | .SetReadFromFileAtSyntaxAllowed() |
| 77 | .SetMetaVar("<WHERE>|@<filename>") |
| 78 | .SetRemoveSQLCommentsEnabled(); |
| 79 | AddArg("fid", 0, _("Feature identifier"), &m_fid) |
| 80 | .SetMetaVar("FID") |
| 81 | .SetMutualExclusionGroup("layer-sql"); |
| 82 | AddArg("dialect", 0, _("SQL dialect"), &m_dialect); |
| 83 | AddOutputStringArg(&m_output); |
| 84 | AddStdoutArg(&m_stdout); |
| 85 | AddArg("crs-format", 0, _("Which format to use to report CRS"), |
| 86 | &m_crsFormat) |
nothing calls this directly
no test coverage detected