You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CHANGELOG.md
+9
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,15 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
16
16
17
17
## 📚 Documentation -->
18
18
19
+
# [0.10.1] - 2022-11-28
20
+
21
+
## 🚀 Features
22
+
23
+
-**Replace the '--output' option type with '--format' - @gocamille, #1413 fixes #1212**
24
+
25
+
This change adds the new option, `--format`, to allow users to define the format type for messages printed to `stdout` (either by passing `plain` or `json` as an argument to `--format`). This replaces the use of `--output` for defining format types. The `--output` option will be available to define the output file type instead, following [Command Line Interface Guidelines for file outputs](https://clig.dev/#:~:text=%2Do%2C%20%2D%2Doutput%3A%20Output%20file.%20For%20example%2C%20sort%2C%20gcc.). This is an additive, non-breaking change and using the `--output` option will continue to be valid.
Copy file name to clipboardexpand all lines: docs/source/commands/subgraphs.mdx
+2-2
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ The subgraph must be reachable by Rover. The subgraph does _not_ need to have in
54
54
55
55
#### Watching for schema changes
56
56
57
-
If you pass `--watch` to `rover subgraph introspect`, Rover introspects your subgraph every second. Whenever the returned schema differs from the _previously_ returned schema, Rover outputs the updated schema.
57
+
If you pass `--watch` to `rover subgraph introspect`, Rover introspects your subgraph every second. Whenever the returned schema differs from the _previously_ returned schema, Rover outputs the updated schema. This is most useful when combined with the `--output <OUTPUT_FILE>` argument which will write the introspection response out to a file whenever its contents change.
58
58
59
59
#### Including headers
60
60
@@ -83,7 +83,7 @@ You can also save the output to a local `.graphql` file like so:
83
83
84
84
```bash
85
85
# Creates accounts-schema.graphql or overwrites if it already exists
If Rover log messages are unhelpful or unclear, please leave us feedback in an
75
75
[issue on GitHub](https://github.com/apollographql/rover/issues/new/choose)!
76
76
77
-
## Output format
78
-
79
-
### `--output plain` (default)
77
+
## Configuring output
80
78
81
79
By default, Rover prints the main output of its commands to `stdout` in plaintext. It also prints a _descriptor_ for that output to `stderr` if it thinks it's being operated by a human (it checks whether the terminal is TTY).
82
80
83
-
> For more on `stdout`, see [Conventions](./conventions/#using-stdout).
81
+
> For more on `stdout`, see [Conventions](https://chat.openai.com/conventions/#using-stdout).
82
+
83
+
Every Rover command supports two options for configuring its output behavior:
84
+
85
+
-`--format`, for [setting the output format](#setting-output-format) (`plain` or `json`)
86
+
-`--output`, for [writing a command's output to a file](#setting-output-location) instead of `stdout`
84
87
85
-
### `--output json`
88
+
### JSON output
86
89
87
-
For more programmatic control over Rover's output, you can pass `--output json` to any command. Rover JSON output has the following minimal structure:
90
+
> **Note:** The `--format` option was added in Rover v0.11.0. Earlier versions of Rover use the `--output` option to set output format.
91
+
>
92
+
> Current versions of Rover still support using `--output` this way, but that support is deprecated and will be removed in a future release.
93
+
94
+
For more programmatic control over Rover's output, you can pass `--format json` to any command. Rover JSON output has the following minimal structure:
88
95
89
96
```json title="success_example"
90
97
{
@@ -232,7 +239,21 @@ This particular `error` object includes `details` about what went wrong. Notice
232
239
233
240
#### Example `jq` script
234
241
235
-
You can combine the `--output json` flag with the [`jq`](https://stedolan.github.io/jq/) command line tool to create powerful custom workflows. For example, [this gist](https://gist.github.com/EverlastingBugstopper/d6aa0d9a49bcf39f2df53e1cfb9bb88a) demonstrates converting output from `rover {sub}graph check my-graph --output json` to Markdown.
242
+
You can combine the `--format json` flag with the [`jq`](https://stedolan.github.io/jq/) command line tool to create powerful custom workflows. For example, [this gist](https://gist.github.com/EverlastingBugstopper/d6aa0d9a49bcf39f2df53e1cfb9bb88a) demonstrates converting output from `rover {sub}graph check my-graph --format json` to Markdown.
243
+
244
+
### Writing to a file
245
+
246
+
The `--output` option enables you to specify a file destination for writing a Rover command's output:
If the specified file already exists, Rover overwrites it.
253
+
254
+
> **Note:** This functionality is available in Rover v0.11.0 and later. In _earlier_ versions of Rover, the `--output` option instead provides the functionality that's now provided by the [`--format` option](#json-output).
255
+
>
256
+
> Current versions of Rover still support using `--output` like `--format`, but that support is deprecated and will be removed in a future release.
Copy file name to clipboardexpand all lines: docs/source/conventions.md
+5-7
Original file line number
Diff line number
Diff line change
@@ -39,9 +39,9 @@ All Rover commands that interact with the Apollo graph registry require a graph
39
39
40
40
### Using `stdout`
41
41
42
-
Rover commands print to `stdout` in a predictable, portable format. This enables output to be used elsewhere (such as in another CLI, or as input to another Rover command). To help maintain this predictability, Rover prints logs to `stderr` instead of `stdout`.
42
+
Rover commands print to `stdout` in a predictable, portable format. This enables output to be used elsewhere (such as in another CLI, or as input to another Rover command). To help maintain this predictability, Rover prints progress logs to `stderr` instead of `stdout`.
43
43
44
-
To redirect Rover's output to a location other than your terminal, you can use the pipe `|` or output redirect `>`operators.
44
+
To redirect Rover's output to a location other than your terminal, you can use the `--output <OUTPUT_FILE>` argument, the pipe `|`operator, or the redirect `>`operator.
In this example, the output of the `introspect` command is piped to `pbcopy`, a MacOS command that copies a value to the clipboard. Certain Rover commands also accept values from `stdin`, as explained in [Using `stdin`](#using-stdin).
55
55
56
-
#### Output redirect `>`
56
+
#### Output to a file
57
57
58
-
Use the output redirect operator to write the `stdout` of a command to a file, like so:
58
+
Use the `--output <OUTPUT_FILE>` argument to write command output to a file.
In this example, the schema returned by `graph fetch` is written to the file `schema.graphql`. If this file already exists, it's overwritten. Otherwise, it's created.
Copy file name to clipboardexpand all lines: docs/source/migration.md
+6-8
Original file line number
Diff line number
Diff line change
@@ -144,9 +144,9 @@ As a workaround, you might be able to use `cat` to combine multiple files and pa
144
144
145
145
### Machine-readable output
146
146
147
-
In the Apollo CLI, many commands support alternate output formatting options, such as `--json` and `--markdown`. Currently, Rover only supports `--output json`, and leaves markdown formatting up to the consumer. For more information on JSON output in Rover, see [these docs](./configuring/#--output-json).
147
+
In the Apollo CLI, many commands support alternate output formatting options, such as `--json` and `--markdown`. Currently, Rover only supports `--format json`, and leaves markdown formatting up to the consumer. For more information on JSON output in Rover, see [these docs](./configuring/#json-output).
148
148
149
-
An example script for converting output from `rover {sub}graph check my-graph --output json` can be found in [this gist](https://gist.github.com/EverlastingBugstopper/d6aa0d9a49bcf39f2df53e1cfb9bb88a).
149
+
An example script for converting output from `rover {sub}graph check my-graph --format json` can be found in [this gist](https://gist.github.com/EverlastingBugstopper/d6aa0d9a49bcf39f2df53e1cfb9bb88a).
150
150
151
151
## Examples
152
152
@@ -160,8 +160,8 @@ An example script for converting output from `rover {sub}graph check my-graph --
160
160
apollo client:download-schema --graph my-graph --variant prod
161
161
162
162
## Rover ##
163
-
# automatically outputs to stdout. Can redirect to schema.graphql
164
-
rover graph fetch my-graph@prod > schema.graphql
163
+
# automatically outputs to stdout. Can redirect to schema.graphql with the `--output <OUTPUT_FILE>` argument
0 commit comments