feat(xo-cli): document config export (#2662)

This commit is contained in:
Julien Fontanet 2018-02-20 11:43:38 +01:00 committed by GitHub
parent c5fdab7d47
commit fd2580f5da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -105,6 +105,12 @@ encoding by prefixing with `json:`:
> xo-cli foo.bar baz='json:[1, 2, 3]'
```
##### Configuration export
```
> xo-cli xo.exportConfig @=config.json
```
##### VM export
```

View File

@ -328,6 +328,15 @@ async function listObjects (args) {
}
exports.listObjects = listObjects
function ensurePathParam (method, value) {
if (typeof value !== 'string') {
const error =
method +
' requires the @ parameter to be a path (e.g. @=/tmp/config.json)'
throw error
}
}
async function call (args) {
if (!args.length) {
throw new Error('missing command name')
@ -350,6 +359,7 @@ async function call (args) {
key = keys[0]
if (key === '$getFrom') {
ensurePathParam(method, file)
url = resolveUrl(baseUrl, result[key])
const output = createWriteStream(file)
@ -371,6 +381,7 @@ async function call (args) {
}
if (key === '$sendTo') {
ensurePathParam(method, file)
url = resolveUrl(baseUrl, result[key])
const stats = await stat(file)