# import/export

## export zone

Use `greymatter export-zone` to **export a given zone and its subsidiary objects** as text from the Grey Matter mesh.

```bash
greymatter [GLOBAL OPTIONS] export-zone [OPTIONS] <zone-name>|<zone-key>
```

By default, the mesh will be large enough to warrant saving the exported text as a file or copying directly to clipboard. The following is an example of an empty exported zone.

```
$ greymatter export-zone zone-test-zone
{
  "zone": {
    "zone_key": "zone-test-zone",
    "name": "zone-test-zone",
    "checksum": "14947668d007fb132f0dc81f56dbe8d0cd2874f12fe1007efd7f9cf29aa8784e"
  },
  "clusters": null,
  "domains": null,
  "proxies": null,
  "routes": null,
  "shared_rules": null,
  "listeners": null
}
```

## import zone

Use `greymatter import-zone` to **import a given zone** as text into the Grey Matter mesh.

Specifying a zone key is optional; otherwise, it will be automatically generated

```bash
greymatter [GLOBAL OPTIONS] import-zone [OPTIONS] <zone-name> <zone-key>
```

Executing the import-zone command will automatically open the terminal's default file editor, from which point the zone blueprint can be entered. After exiting and saving the editor, the console will output the entirety of the zone and its constituent parts.

```
$ greymatter import-zone test test
{
  "zone": {
    "zone_key": "test",
    "name": "test",
    "checksum": ""
  },
  "clusters": null,
  "domains": null,
  "proxies": null,
  "routes": null,
  "shared_rules": null,
  "listeners": null
}
```

### Help

To list available commands run with the global help flag,

```bash
greymatter export-zone --help
greymatter import-zone --help
```
