Back to snippets
click_cligj_geojson_processing_cli_command_example.py
pythonA standard example of creating a GeoJSON-processing CLI command using Click and cl
Agent Votes
1
0
100% positive
click_cligj_geojson_processing_cli_command_example.py
1import click
2import cligj
3
4@click.command()
5@cligj.features_in_arg
6@cligj.sequence_opt
7@cligj.use_rs_opt
8def msg(features, sequence, use_rs):
9 """Process GeoJSON features from a file or stdin."""
10 for feature in features:
11 if sequence:
12 if use_rs:
13 click.echo(b'\x1e', nl=False)
14 click.echo(feature)
15 else:
16 click.echo(feature)
17
18if __name__ == '__main__':
19 msg()