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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#[derive(Debug, clap::Subcommand)]
pub enum Subcommand {
    /// Creates a STAC Item.
    Item {
        /// The item id or asset href.
        id_or_href: String,

        /// The item id, if the positional argument is an href.
        ///
        /// If not provided, will be inferred from the filename in the href.
        #[arg(short, long)]
        id: Option<String>,

        /// The asset key, if the positional argument is an href.
        #[arg(short, long, default_value = "data")]
        key: String,

        /// The asset roles, if the positional argument is an href.
        ///
        /// Can be provided multiple times.
        #[arg(short, long)]
        role: Vec<String>,

        /// Allow relative paths.
        ///
        /// If false, all path will be canonicalized, which requires that the
        /// files actually exist on the filesystem.
        #[arg(long)]
        allow_relative_paths: bool,

        /// Don't use GDAL for item creation, if the positional argument is an href.
        ///
        /// Automatically set to true if this crate is compiled without GDAL.
        #[arg(long)]
        disable_gdal: bool,

        /// Collect an item or item collection from standard input, and add the
        /// newly created to it into a new item collection.
        #[arg(short, long)]
        collect: bool,
    },

    /// Searches a STAC API.
    Search {
        /// The href of the STAC API.
        href: String,

        /// The maximum number of items to print.
        #[arg(short, long)]
        max_items: Option<usize>,

        /// The maximum number of results to return (page size).
        #[arg(short, long)]
        limit: Option<String>,

        /// Requested bounding box.
        #[arg(short, long)]
        bbox: Option<String>,

        /// Requested bounding box.
        /// Use double dots `..` for open date ranges.
        #[arg(short, long)]
        datetime: Option<String>,

        /// Searches items by performing intersection between their geometry and provided GeoJSON geometry.
        ///
        /// All GeoJSON geometry types must be supported.
        #[arg(long)]
        intersects: Option<String>,

        /// Comma-delimited list of one ore more Item ids to return.
        #[arg(short, long)]
        ids: Option<String>,

        /// Comma-delimited list of one or more Collection IDs that each matching Item must be in.
        #[arg(short, long)]
        collections: Option<String>,

        /// Include/exclude fields from item collections.
        #[arg(long)]
        fields: Option<String>,

        /// Fields by which to sort results.
        #[arg(short, long)]
        sortby: Option<String>,

        /// Recommended to not be passed, but server must only accept
        /// <http://www.opengis.net/def/crs/OGC/1.3/CRS84> as a valid value, may
        /// reject any others
        #[arg(long)]
        filter_crs: Option<String>,

        /// CQL2 filter expression.
        #[arg(long)]
        filter_lang: Option<String>,

        /// CQL2 filter expression.
        #[arg(short, long)]
        filter: Option<String>,

        /// Stream the items to standard output as ndjson.
        #[arg(long)]
        stream: bool,
    },

    /// Serves a STAC API.
    ///
    /// By default, uses a basic memory backend, which is not suitable for
    /// production. To use the pgstac backend, pass the pgstac connection string
    /// to the `--pgstac` argument.
    Serve {
        /// Hrefs of STAC collections and items to load before starting the server.
        href: Vec<String>,

        /// The pgstac connection string.
        #[arg(long)]
        pgstac: Option<String>,
    },

    /// Sorts the fields of STAC object.
    Sort {
        /// The href of the STAC object.
        ///
        /// If this is not provided, will read from standard input.
        href: Option<String>,
    },

    /// Validates a STAC object or API endpoint using json-schema validation.
    Validate {
        /// The href of the STAC object or endpoint.
        ///
        /// The validator will make some decisions depending on what type of
        /// data is returned from the href. If it's a STAC Catalog, Collection,
        /// or Item, that object will be validated. If its a collections
        /// endpoint from a STAC API, all collections will be validated.
        /// Additional behavior TBD.
        ///
        /// If this is not provided, will read from standard input.
        href: Option<String>,
    },
}