Skip to content

Commit ce651e9

Browse files
authored
feat(versions): stringify JSON for --raw option (#404)
1 parent c16b0e4 commit ce651e9

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ rdme docs:edit <slug> --version={project-version}
9393
rdme versions
9494
```
9595

96-
If you wish to see the raw output from our API in this response, supply the `--raw` flag.
96+
If you wish to see the raw JSON output from our API in this response, supply the `--raw` flag.
9797

9898
#### Get All Information About a Particular Version
9999
```sh
100100
rdme versions --version={project-version}
101101
```
102102

103-
If you wish to see the raw output from our API in this response, supply the `--raw` flag.
103+
If you wish to see the raw JSON output from our API in this response, supply the `--raw` flag.
104104

105105
#### Create a New Version
106106
```sh

__tests__/cmds/versions.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('rdme versions*', () => {
6464
.reply(200, [versionPayload, version2Payload]);
6565

6666
const response = await versions.run({ key, raw: true });
67-
expect(response).toStrictEqual([versionPayload, version2Payload]);
67+
expect(response).toStrictEqual(JSON.stringify([versionPayload, version2Payload], null, 2));
6868
mockRequest.done();
6969
});
7070

@@ -88,7 +88,7 @@ describe('rdme versions*', () => {
8888
.reply(200, versionPayload);
8989

9090
return versions.run({ key, version, raw: true }).then(response => {
91-
expect(response).toStrictEqual(versionPayload);
91+
expect(response).toStrictEqual(JSON.stringify(versionPayload, null, 2));
9292
mockRequest.done();
9393
});
9494
});

src/cmds/versions/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ exports.run = function (opts) {
102102
}
103103

104104
if (raw) {
105-
return Promise.resolve(data);
105+
return Promise.resolve(JSON.stringify(data, null, 2));
106106
}
107107

108108
let versions = data;

0 commit comments

Comments
 (0)