@blockforfun/plugin-git
Advanced tools
Comparing version 4.3.0 to 5.0.0
@@ -6,2 +6,24 @@ # Change Log | ||
# [5.0.0](https://github.com/blockforfun/cli/compare/@blockforfun/plugin-git@4.3.0...@blockforfun/plugin-git@5.0.0) (2018-12-13) | ||
### Bug Fixes | ||
* Only destroy this.in if it's set ([09bc115](https://github.com/blockforfun/cli/commit/09bc115)) | ||
### Features | ||
* Move output argument to flag ([f32a018](https://github.com/blockforfun/cli/commit/f32a018)) | ||
### BREAKING CHANGES | ||
* Move the `OUTPUT` argument to the `-output` flag | ||
# [4.3.0](https://github.com/blockforfun/cli/compare/@blockforfun/plugin-git@4.2.5...@blockforfun/plugin-git@4.3.0) (2018-12-10) | ||
@@ -8,0 +30,0 @@ |
@@ -1,1 +0,1 @@ | ||
{"version":"4.3.0","commands":{"delete:json":{"id":"delete:json","description":"deletes entries in json format from a BlockFor.fun git registry","pluginName":"@blockforfun/plugin-git","pluginType":"core","aliases":["rm:json","del:json"],"flags":{"ref":{"name":"ref","type":"option","char":"r","description":"git ref","default":"refs/heads/master"},"spec":{"name":"spec","type":"option","char":"s","description":"git fetch refspec","default":"refs/heads/*:refs/heads/*"},"fetch":{"name":"fetch","type":"option","char":"f","description":"git fetch URL"}},"args":[{"name":"source","description":"git repository URL or path","required":true},{"name":"path","description":"git file path","required":true},{"name":"output","description":"output file path"}]},"delete:text":{"id":"delete:text","description":"deletes entries in text format from a BlockFor.fun git registry","pluginName":"@blockforfun/plugin-git","pluginType":"core","aliases":["rm:text","del:text"],"flags":{"ref":{"name":"ref","type":"option","char":"r","description":"git ref","default":"refs/heads/master"},"spec":{"name":"spec","type":"option","char":"s","description":"git fetch refspec","default":"refs/heads/*:refs/heads/*"},"fetch":{"name":"fetch","type":"option","char":"f","description":"git fetch URL"}},"args":[{"name":"source","description":"git repository URL or path","required":true},{"name":"path","description":"git file path","required":true},{"name":"output","description":"output file path"}]},"list:json":{"id":"list:json","description":"lists entries in json format from a BlockFor.fun git registry","pluginName":"@blockforfun/plugin-git","pluginType":"core","aliases":["ls:json"],"flags":{"ref":{"name":"ref","type":"option","char":"r","description":"git ref","default":"refs/heads/master"},"spec":{"name":"spec","type":"option","char":"s","description":"git fetch refspec","default":"refs/heads/*:refs/heads/*"},"fetch":{"name":"fetch","type":"option","char":"f","description":"git fetch URL"}},"args":[{"name":"source","description":"git repository URL or path","required":true},{"name":"output","description":"output file path"}]},"list:text":{"id":"list:text","description":"lists entries in text format from a BlockFor.fun git registry","pluginName":"@blockforfun/plugin-git","pluginType":"core","aliases":["ls:text"],"flags":{"ref":{"name":"ref","type":"option","char":"r","description":"git ref","default":"refs/heads/master"},"spec":{"name":"spec","type":"option","char":"s","description":"git fetch refspec","default":"refs/heads/*:refs/heads/*"},"fetch":{"name":"fetch","type":"option","char":"f","description":"git fetch URL"}},"args":[{"name":"source","description":"git repository URL or path","required":true},{"name":"output","description":"output file path"}]},"read:json":{"id":"read:json","description":"reads entries in json format from a BlockFor.fun git registry","pluginName":"@blockforfun/plugin-git","pluginType":"core","aliases":["get:json"],"flags":{"ref":{"name":"ref","type":"option","char":"r","description":"git ref","default":"refs/heads/master"},"spec":{"name":"spec","type":"option","char":"s","description":"git fetch refspec","default":"refs/heads/*:refs/heads/*"},"fetch":{"name":"fetch","type":"option","char":"f","description":"git fetch URL"}},"args":[{"name":"source","description":"git repository URL or path","required":true},{"name":"path","description":"git file path","required":true},{"name":"output","description":"output file path"}]},"read:text":{"id":"read:text","description":"reads entries in text format from a BlockFor.fun git registry","pluginName":"@blockforfun/plugin-git","pluginType":"core","aliases":["get:text"],"flags":{"ref":{"name":"ref","type":"option","char":"r","description":"git ref","default":"refs/heads/master"},"spec":{"name":"spec","type":"option","char":"s","description":"git fetch refspec","default":"refs/heads/*:refs/heads/*"},"fetch":{"name":"fetch","type":"option","char":"f","description":"git fetch URL"}},"args":[{"name":"source","description":"git repository URL or path","required":true},{"name":"path","description":"git file path","required":true},{"name":"output","description":"output file path"}]},"write:json":{"id":"write:json","description":"writes entries in json format to a BlockFor.fun git registry","pluginName":"@blockforfun/plugin-git","pluginType":"core","aliases":["put:json"],"flags":{"ref":{"name":"ref","type":"option","char":"r","description":"git ref","default":"refs/heads/master"},"spec":{"name":"spec","type":"option","char":"s","description":"git fetch refspec","default":"refs/heads/*:refs/heads/*"},"fetch":{"name":"fetch","type":"option","char":"f","description":"git fetch URL"}},"args":[{"name":"source","description":"git repository URL or path","required":true},{"name":"path","description":"git file path","required":true},{"name":"input","description":"input file path"}]},"write:text":{"id":"write:text","description":"writes entries in text format to a BlockFor.fun git registry","pluginName":"@blockforfun/plugin-git","pluginType":"core","aliases":["put:text"],"flags":{"ref":{"name":"ref","type":"option","char":"r","description":"git ref","default":"refs/heads/master"},"spec":{"name":"spec","type":"option","char":"s","description":"git fetch refspec","default":"refs/heads/*:refs/heads/*"},"fetch":{"name":"fetch","type":"option","char":"f","description":"git fetch URL"}},"args":[{"name":"source","description":"git repository URL or path","required":true},{"name":"path","description":"git file path","required":true},{"name":"input","description":"input file path"}]}}} | ||
{"version":"5.0.0","commands":{"delete:json":{"id":"delete:json","description":"deletes entries in json format from a BlockFor.fun git registry","pluginName":"@blockforfun/plugin-git","pluginType":"core","aliases":["rm:json","del:json"],"flags":{"ref":{"name":"ref","type":"option","char":"r","description":"git ref","default":"refs/heads/master"},"spec":{"name":"spec","type":"option","char":"s","description":"git fetch refspec","default":"refs/heads/*:refs/heads/*"},"fetch":{"name":"fetch","type":"option","char":"f","description":"git fetch URL"},"output":{"name":"output","type":"option","char":"o","description":"output file path"}},"args":[{"name":"source","description":"git repository URL or path","required":true},{"name":"path","description":"git file path","required":true}]},"delete:text":{"id":"delete:text","description":"deletes entries in text format from a BlockFor.fun git registry","pluginName":"@blockforfun/plugin-git","pluginType":"core","aliases":["rm:text","del:text"],"flags":{"ref":{"name":"ref","type":"option","char":"r","description":"git ref","default":"refs/heads/master"},"spec":{"name":"spec","type":"option","char":"s","description":"git fetch refspec","default":"refs/heads/*:refs/heads/*"},"fetch":{"name":"fetch","type":"option","char":"f","description":"git fetch URL"},"output":{"name":"output","type":"option","char":"o","description":"output file path"}},"args":[{"name":"source","description":"git repository URL or path","required":true},{"name":"path","description":"git file path","required":true}]},"list:json":{"id":"list:json","description":"lists entries in json format from a BlockFor.fun git registry","pluginName":"@blockforfun/plugin-git","pluginType":"core","aliases":["ls:json"],"flags":{"ref":{"name":"ref","type":"option","char":"r","description":"git ref","default":"refs/heads/master"},"spec":{"name":"spec","type":"option","char":"s","description":"git fetch refspec","default":"refs/heads/*:refs/heads/*"},"fetch":{"name":"fetch","type":"option","char":"f","description":"git fetch URL"},"output":{"name":"output","type":"option","char":"o","description":"output file path"}},"args":[{"name":"source","description":"git repository URL or path","required":true}]},"list:text":{"id":"list:text","description":"lists entries in text format from a BlockFor.fun git registry","pluginName":"@blockforfun/plugin-git","pluginType":"core","aliases":["ls:text"],"flags":{"ref":{"name":"ref","type":"option","char":"r","description":"git ref","default":"refs/heads/master"},"spec":{"name":"spec","type":"option","char":"s","description":"git fetch refspec","default":"refs/heads/*:refs/heads/*"},"fetch":{"name":"fetch","type":"option","char":"f","description":"git fetch URL"},"output":{"name":"output","type":"option","char":"o","description":"output file path"}},"args":[{"name":"source","description":"git repository URL or path","required":true}]},"read:json":{"id":"read:json","description":"reads entries in json format from a BlockFor.fun git registry","pluginName":"@blockforfun/plugin-git","pluginType":"core","aliases":["get:json"],"flags":{"ref":{"name":"ref","type":"option","char":"r","description":"git ref","default":"refs/heads/master"},"spec":{"name":"spec","type":"option","char":"s","description":"git fetch refspec","default":"refs/heads/*:refs/heads/*"},"fetch":{"name":"fetch","type":"option","char":"f","description":"git fetch URL"},"output":{"name":"output","type":"option","char":"o","description":"output file path"}},"args":[{"name":"source","description":"git repository URL or path","required":true},{"name":"path","description":"git file path","required":true}]},"read:text":{"id":"read:text","description":"reads entries in text format from a BlockFor.fun git registry","pluginName":"@blockforfun/plugin-git","pluginType":"core","aliases":["get:text"],"flags":{"ref":{"name":"ref","type":"option","char":"r","description":"git ref","default":"refs/heads/master"},"spec":{"name":"spec","type":"option","char":"s","description":"git fetch refspec","default":"refs/heads/*:refs/heads/*"},"fetch":{"name":"fetch","type":"option","char":"f","description":"git fetch URL"},"output":{"name":"output","type":"option","char":"o","description":"output file path"}},"args":[{"name":"source","description":"git repository URL or path","required":true},{"name":"path","description":"git file path","required":true}]},"write:json":{"id":"write:json","description":"writes entries in json format to a BlockFor.fun git registry","pluginName":"@blockforfun/plugin-git","pluginType":"core","aliases":["put:json"],"flags":{"ref":{"name":"ref","type":"option","char":"r","description":"git ref","default":"refs/heads/master"},"spec":{"name":"spec","type":"option","char":"s","description":"git fetch refspec","default":"refs/heads/*:refs/heads/*"},"fetch":{"name":"fetch","type":"option","char":"f","description":"git fetch URL"}},"args":[{"name":"source","description":"git repository URL or path","required":true},{"name":"path","description":"git file path","required":true},{"name":"input","description":"input file path"}]},"write:text":{"id":"write:text","description":"writes entries in text format to a BlockFor.fun git registry","pluginName":"@blockforfun/plugin-git","pluginType":"core","aliases":["put:text"],"flags":{"ref":{"name":"ref","type":"option","char":"r","description":"git ref","default":"refs/heads/master"},"spec":{"name":"spec","type":"option","char":"s","description":"git fetch refspec","default":"refs/heads/*:refs/heads/*"},"fetch":{"name":"fetch","type":"option","char":"f","description":"git fetch URL"}},"args":[{"name":"source","description":"git repository URL or path","required":true},{"name":"path","description":"git file path","required":true},{"name":"input","description":"input file path"}]}}} |
{ | ||
"name": "@blockforfun/plugin-git", | ||
"description": "BlockFor.fun CLI git plugin", | ||
"version": "4.3.0", | ||
"version": "5.0.0", | ||
"author": "Mikael Karon <mikael@karon.se>", | ||
@@ -73,3 +73,3 @@ "bugs": "https://github.com/blockforfun/cli/issues", | ||
}, | ||
"gitHead": "9b8d07e0960bc3e73d37681d8bcb93dea3a529fd" | ||
"gitHead": "4e5f27f131c5e885fc932d7be8a71c7ab684d2fa" | ||
} |
102
README.md
@@ -25,3 +25,3 @@ @blockforfun/plugin-git | ||
$ oclif-example (-v|--version|version) | ||
@blockforfun/plugin-git/4.3.0 win32-x64 node-v10.10.0 | ||
@blockforfun/plugin-git/5.0.0 win32-x64 node-v10.10.0 | ||
$ oclif-example --help [COMMAND] | ||
@@ -37,12 +37,12 @@ USAGE | ||
<!-- commands --> | ||
* [`oclif-example delete:json SOURCE PATH [OUTPUT]`](#oclif-example-deletejson-source-path-output) | ||
* [`oclif-example delete:text SOURCE PATH [OUTPUT]`](#oclif-example-deletetext-source-path-output) | ||
* [`oclif-example list:json SOURCE [OUTPUT]`](#oclif-example-listjson-source-output) | ||
* [`oclif-example list:text SOURCE [OUTPUT]`](#oclif-example-listtext-source-output) | ||
* [`oclif-example read:json SOURCE PATH [OUTPUT]`](#oclif-example-readjson-source-path-output) | ||
* [`oclif-example read:text SOURCE PATH [OUTPUT]`](#oclif-example-readtext-source-path-output) | ||
* [`oclif-example delete:json SOURCE PATH`](#oclif-example-deletejson-source-path) | ||
* [`oclif-example delete:text SOURCE PATH`](#oclif-example-deletetext-source-path) | ||
* [`oclif-example list:json SOURCE`](#oclif-example-listjson-source) | ||
* [`oclif-example list:text SOURCE`](#oclif-example-listtext-source) | ||
* [`oclif-example read:json SOURCE PATH`](#oclif-example-readjson-source-path) | ||
* [`oclif-example read:text SOURCE PATH`](#oclif-example-readtext-source-path) | ||
* [`oclif-example write:json SOURCE PATH [INPUT]`](#oclif-example-writejson-source-path-input) | ||
* [`oclif-example write:text SOURCE PATH [INPUT]`](#oclif-example-writetext-source-path-input) | ||
## `oclif-example delete:json SOURCE PATH [OUTPUT]` | ||
## `oclif-example delete:json SOURCE PATH` | ||
@@ -53,3 +53,3 @@ deletes entries in json format from a BlockFor.fun git registry | ||
USAGE | ||
$ oclif-example delete:json SOURCE PATH [OUTPUT] | ||
$ oclif-example delete:json SOURCE PATH | ||
@@ -59,8 +59,8 @@ ARGUMENTS | ||
PATH git file path | ||
OUTPUT output file path | ||
OPTIONS | ||
-f, --fetch=fetch git fetch URL | ||
-r, --ref=ref [default: refs/heads/master] git ref | ||
-s, --spec=spec [default: refs/heads/*:refs/heads/*] git fetch refspec | ||
-f, --fetch=fetch git fetch URL | ||
-o, --output=output output file path | ||
-r, --ref=ref [default: refs/heads/master] git ref | ||
-s, --spec=spec [default: refs/heads/*:refs/heads/*] git fetch refspec | ||
@@ -72,5 +72,5 @@ ALIASES | ||
_See code: [src\commands\delete\json.js](https://github.com/blockforfun/cli/blob/v4.3.0/src\commands\delete\json.js)_ | ||
_See code: [src\commands\delete\json.js](https://github.com/blockforfun/cli/blob/v5.0.0/src\commands\delete\json.js)_ | ||
## `oclif-example delete:text SOURCE PATH [OUTPUT]` | ||
## `oclif-example delete:text SOURCE PATH` | ||
@@ -81,3 +81,3 @@ deletes entries in text format from a BlockFor.fun git registry | ||
USAGE | ||
$ oclif-example delete:text SOURCE PATH [OUTPUT] | ||
$ oclif-example delete:text SOURCE PATH | ||
@@ -87,8 +87,8 @@ ARGUMENTS | ||
PATH git file path | ||
OUTPUT output file path | ||
OPTIONS | ||
-f, --fetch=fetch git fetch URL | ||
-r, --ref=ref [default: refs/heads/master] git ref | ||
-s, --spec=spec [default: refs/heads/*:refs/heads/*] git fetch refspec | ||
-f, --fetch=fetch git fetch URL | ||
-o, --output=output output file path | ||
-r, --ref=ref [default: refs/heads/master] git ref | ||
-s, --spec=spec [default: refs/heads/*:refs/heads/*] git fetch refspec | ||
@@ -100,5 +100,5 @@ ALIASES | ||
_See code: [src\commands\delete\text.js](https://github.com/blockforfun/cli/blob/v4.3.0/src\commands\delete\text.js)_ | ||
_See code: [src\commands\delete\text.js](https://github.com/blockforfun/cli/blob/v5.0.0/src\commands\delete\text.js)_ | ||
## `oclif-example list:json SOURCE [OUTPUT]` | ||
## `oclif-example list:json SOURCE` | ||
@@ -109,12 +109,12 @@ lists entries in json format from a BlockFor.fun git registry | ||
USAGE | ||
$ oclif-example list:json SOURCE [OUTPUT] | ||
$ oclif-example list:json SOURCE | ||
ARGUMENTS | ||
SOURCE git repository URL or path | ||
OUTPUT output file path | ||
OPTIONS | ||
-f, --fetch=fetch git fetch URL | ||
-r, --ref=ref [default: refs/heads/master] git ref | ||
-s, --spec=spec [default: refs/heads/*:refs/heads/*] git fetch refspec | ||
-f, --fetch=fetch git fetch URL | ||
-o, --output=output output file path | ||
-r, --ref=ref [default: refs/heads/master] git ref | ||
-s, --spec=spec [default: refs/heads/*:refs/heads/*] git fetch refspec | ||
@@ -125,5 +125,5 @@ ALIASES | ||
_See code: [src\commands\list\json.js](https://github.com/blockforfun/cli/blob/v4.3.0/src\commands\list\json.js)_ | ||
_See code: [src\commands\list\json.js](https://github.com/blockforfun/cli/blob/v5.0.0/src\commands\list\json.js)_ | ||
## `oclif-example list:text SOURCE [OUTPUT]` | ||
## `oclif-example list:text SOURCE` | ||
@@ -134,12 +134,12 @@ lists entries in text format from a BlockFor.fun git registry | ||
USAGE | ||
$ oclif-example list:text SOURCE [OUTPUT] | ||
$ oclif-example list:text SOURCE | ||
ARGUMENTS | ||
SOURCE git repository URL or path | ||
OUTPUT output file path | ||
OPTIONS | ||
-f, --fetch=fetch git fetch URL | ||
-r, --ref=ref [default: refs/heads/master] git ref | ||
-s, --spec=spec [default: refs/heads/*:refs/heads/*] git fetch refspec | ||
-f, --fetch=fetch git fetch URL | ||
-o, --output=output output file path | ||
-r, --ref=ref [default: refs/heads/master] git ref | ||
-s, --spec=spec [default: refs/heads/*:refs/heads/*] git fetch refspec | ||
@@ -150,5 +150,5 @@ ALIASES | ||
_See code: [src\commands\list\text.js](https://github.com/blockforfun/cli/blob/v4.3.0/src\commands\list\text.js)_ | ||
_See code: [src\commands\list\text.js](https://github.com/blockforfun/cli/blob/v5.0.0/src\commands\list\text.js)_ | ||
## `oclif-example read:json SOURCE PATH [OUTPUT]` | ||
## `oclif-example read:json SOURCE PATH` | ||
@@ -159,3 +159,3 @@ reads entries in json format from a BlockFor.fun git registry | ||
USAGE | ||
$ oclif-example read:json SOURCE PATH [OUTPUT] | ||
$ oclif-example read:json SOURCE PATH | ||
@@ -165,8 +165,8 @@ ARGUMENTS | ||
PATH git file path | ||
OUTPUT output file path | ||
OPTIONS | ||
-f, --fetch=fetch git fetch URL | ||
-r, --ref=ref [default: refs/heads/master] git ref | ||
-s, --spec=spec [default: refs/heads/*:refs/heads/*] git fetch refspec | ||
-f, --fetch=fetch git fetch URL | ||
-o, --output=output output file path | ||
-r, --ref=ref [default: refs/heads/master] git ref | ||
-s, --spec=spec [default: refs/heads/*:refs/heads/*] git fetch refspec | ||
@@ -177,5 +177,5 @@ ALIASES | ||
_See code: [src\commands\read\json.js](https://github.com/blockforfun/cli/blob/v4.3.0/src\commands\read\json.js)_ | ||
_See code: [src\commands\read\json.js](https://github.com/blockforfun/cli/blob/v5.0.0/src\commands\read\json.js)_ | ||
## `oclif-example read:text SOURCE PATH [OUTPUT]` | ||
## `oclif-example read:text SOURCE PATH` | ||
@@ -186,3 +186,3 @@ reads entries in text format from a BlockFor.fun git registry | ||
USAGE | ||
$ oclif-example read:text SOURCE PATH [OUTPUT] | ||
$ oclif-example read:text SOURCE PATH | ||
@@ -192,8 +192,8 @@ ARGUMENTS | ||
PATH git file path | ||
OUTPUT output file path | ||
OPTIONS | ||
-f, --fetch=fetch git fetch URL | ||
-r, --ref=ref [default: refs/heads/master] git ref | ||
-s, --spec=spec [default: refs/heads/*:refs/heads/*] git fetch refspec | ||
-f, --fetch=fetch git fetch URL | ||
-o, --output=output output file path | ||
-r, --ref=ref [default: refs/heads/master] git ref | ||
-s, --spec=spec [default: refs/heads/*:refs/heads/*] git fetch refspec | ||
@@ -204,3 +204,3 @@ ALIASES | ||
_See code: [src\commands\read\text.js](https://github.com/blockforfun/cli/blob/v4.3.0/src\commands\read\text.js)_ | ||
_See code: [src\commands\read\text.js](https://github.com/blockforfun/cli/blob/v5.0.0/src\commands\read\text.js)_ | ||
@@ -229,3 +229,3 @@ ## `oclif-example write:json SOURCE PATH [INPUT]` | ||
_See code: [src\commands\write\json.js](https://github.com/blockforfun/cli/blob/v4.3.0/src\commands\write\json.js)_ | ||
_See code: [src\commands\write\json.js](https://github.com/blockforfun/cli/blob/v5.0.0/src\commands\write\json.js)_ | ||
@@ -254,3 +254,3 @@ ## `oclif-example write:text SOURCE PATH [INPUT]` | ||
_See code: [src\commands\write\text.js](https://github.com/blockforfun/cli/blob/v4.3.0/src\commands\write\text.js)_ | ||
_See code: [src\commands\write\text.js](https://github.com/blockforfun/cli/blob/v5.0.0/src\commands\write\text.js)_ | ||
<!-- commandsstop --> |
@@ -12,3 +12,3 @@ const GitOutCommand = require('../../git-out-command') | ||
async run() { | ||
const {args: {path, output}, flags: {ref}, flags} = this | ||
const {args: {path}, flags, flags: {ref, output}} = this | ||
const count = await this.delete(ref, path, flags) | ||
@@ -21,3 +21,3 @@ this.log(`${output ? 'Wrote' : 'Deleted'} ${count} ${count === 1 ? 'entry' : 'entries'}`) | ||
DeleteTextCommand.args = [ | ||
...GitOutCommand.args.slice(0, -1), | ||
...GitOutCommand.args, | ||
{ | ||
@@ -28,3 +28,2 @@ name: 'path', | ||
}, | ||
...GitOutCommand.args.slice(-1), | ||
] | ||
@@ -31,0 +30,0 @@ DeleteTextCommand.flags = GitOutCommand.flags |
@@ -14,3 +14,3 @@ const GitOutCommand = require('../../git-out-command') | ||
async run() { | ||
const {args: {output}, flags: {ref}, flags} = this | ||
const {flags, flags: {ref, output}} = this | ||
const count = await this.list(ref, flags) | ||
@@ -17,0 +17,0 @@ this.log(`${output ? 'Wrote' : 'Listed'} ${count} ${count === 1 ? 'entry' : 'entries'}`) |
@@ -12,3 +12,3 @@ const GitOutCommand = require('../../git-out-command') | ||
async run() { | ||
const {args: {path, output}, flags, flags: {ref}} = this | ||
const {args: {path}, flags, flags: {ref, output}} = this | ||
const count = await this.read(ref, path, flags) | ||
@@ -21,3 +21,3 @@ this.log(`${output ? 'Wrote' : 'Read'} ${count} ${count === 1 ? 'entry' : 'entries'}`) | ||
ReadTextCommand.args = [ | ||
...GitOutCommand.args.slice(0, -1), | ||
...GitOutCommand.args, | ||
{ | ||
@@ -28,3 +28,2 @@ name: 'path', | ||
}, | ||
...GitOutCommand.args.slice(-1), | ||
] | ||
@@ -31,0 +30,0 @@ ReadTextCommand.flags = GitOutCommand.flags |
@@ -6,2 +6,3 @@ const {createReadStream} = require('fs') | ||
const {parse} = require('../../entry') | ||
const {Readable} = require('stream') | ||
@@ -17,8 +18,12 @@ class WriteTextCommand extends GitOutCommand { | ||
await super.init() | ||
const {args: {input}} = this | ||
let {args: {input}} = this | ||
if (input) { | ||
this.in = input | ||
} else { | ||
if (!input) { | ||
const {stdin, stdin: {isRaw, setRawMode}} = process | ||
// readable sink we can pass round | ||
input = new Readable({ | ||
read() {}, | ||
}) | ||
// pipe input to stdout so we get some feedback | ||
input.pipe(process.stdout) | ||
// without this, we would only get streams once enter is pressed | ||
@@ -38,16 +43,19 @@ if (setRawMode) stdin.setRawMode(true) | ||
if (setRawMode) stdin.setRawMode(Boolean(isRaw)) | ||
// emit 'end' so readers can start | ||
stdin.emit('end') | ||
// signal EOT | ||
input.push(null) | ||
} else { | ||
// write the key to stdout all normal like | ||
process.stdout.write(key) | ||
// push the key to input all normal like | ||
input.push(key) | ||
} | ||
}) | ||
this.in = stdin | ||
// singnal EOT when piped stdin closes | ||
stdin.on('close', () => input.push(null)) | ||
} | ||
// store in stream so we can read() from it later | ||
this.in = input | ||
} | ||
async finally(err) { | ||
const {args: {input} = {}} = this | ||
const {in: input} = this | ||
// clean up in stream resources | ||
if (input) { | ||
@@ -60,3 +68,3 @@ input.destroy() | ||
async run() { | ||
const {args: {path}, flags: {ref}, flags} = this | ||
const {args: {path}, flags, flags: {ref}} = this | ||
const count = await this.write(ref, path, await toString(this.in), flags) | ||
@@ -63,0 +71,0 @@ this.log(`Wrote ${count} ${count === 1 ? 'entry' : 'entries'}`) |
const {createWriteStream} = require('fs') | ||
const {Transform} = require('stream') | ||
const {flags} = require('@oclif/command') | ||
const GitCommand = require('./git-command') | ||
@@ -8,3 +9,3 @@ | ||
await super.init() | ||
const {args: {output = process.stdout}} = this | ||
const {flags: {output = process.stdout}} = this | ||
const out = new Transform({ | ||
@@ -22,3 +23,3 @@ transform(chunk, encoding, done) { | ||
async finally(err) { | ||
const {args: {output} = {}} = this | ||
const {flags: {output} = {}} = this | ||
if (output) { | ||
@@ -32,12 +33,12 @@ output.end() | ||
GitOutCommand.description = 'deletes entries in text format from a BlockFor.fun git registry' | ||
GitOutCommand.args = [ | ||
...GitCommand.args, | ||
{ | ||
name: 'output', | ||
GitOutCommand.args = GitCommand.args | ||
GitOutCommand.flags = { | ||
...GitCommand.flags, | ||
output: flags.string({ | ||
char: 'o', | ||
description: 'output file path', | ||
parse: input => createWriteStream(input), | ||
}, | ||
] | ||
GitOutCommand.flags = GitCommand.flags | ||
}), | ||
} | ||
module.exports = GitOutCommand |
37290
449