@stdlib/string-acronym-cli 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +1 -1
- package/README.md +18 -4
- package/package.json +14 -14
- package/.github/workflows/publish_cli.yml +0 -159
- package/CONTRIBUTORS +0 -31
- package/test/fixtures/stdin_error.js.txt +0 -33
- package/test/test.cli.js +0 -246
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2024 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -18,6 +18,17 @@ limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
-->
|
|
20
20
|
|
|
21
|
+
|
|
22
|
+
<details>
|
|
23
|
+
<summary>
|
|
24
|
+
About stdlib...
|
|
25
|
+
</summary>
|
|
26
|
+
<p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
|
|
27
|
+
<p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
|
|
28
|
+
<p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
|
|
29
|
+
<p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
|
|
30
|
+
</details>
|
|
31
|
+
|
|
21
32
|
# acronym
|
|
22
33
|
|
|
23
34
|
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
|
|
@@ -190,7 +201,7 @@ See [LICENSE][stdlib-license].
|
|
|
190
201
|
|
|
191
202
|
## Copyright
|
|
192
203
|
|
|
193
|
-
Copyright © 2016-
|
|
204
|
+
Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
194
205
|
|
|
195
206
|
</section>
|
|
196
207
|
|
|
@@ -203,8 +214,8 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
|
203
214
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/string-acronym-cli.svg
|
|
204
215
|
[npm-url]: https://npmjs.org/package/@stdlib/string-acronym-cli
|
|
205
216
|
|
|
206
|
-
[test-image]: https://github.com/stdlib-js/string-acronym/actions/workflows/test.yml/badge.svg?branch=v0.
|
|
207
|
-
[test-url]: https://github.com/stdlib-js/string-acronym/actions/workflows/test.yml?query=branch:v0.
|
|
217
|
+
[test-image]: https://github.com/stdlib-js/string-acronym/actions/workflows/test.yml/badge.svg?branch=v0.3.0
|
|
218
|
+
[test-url]: https://github.com/stdlib-js/string-acronym/actions/workflows/test.yml?query=branch:v0.3.0
|
|
208
219
|
|
|
209
220
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/string-acronym/main.svg
|
|
210
221
|
[coverage-url]: https://codecov.io/github/stdlib-js/string-acronym?branch=main
|
|
@@ -217,7 +228,7 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
|
217
228
|
-->
|
|
218
229
|
|
|
219
230
|
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
220
|
-
[chat-url]: https://gitter.im
|
|
231
|
+
[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
|
|
221
232
|
|
|
222
233
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
223
234
|
|
|
@@ -231,8 +242,11 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
|
231
242
|
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
232
243
|
|
|
233
244
|
[deno-url]: https://github.com/stdlib-js/string-acronym/tree/deno
|
|
245
|
+
[deno-readme]: https://github.com/stdlib-js/string-acronym/blob/deno/README.md
|
|
234
246
|
[umd-url]: https://github.com/stdlib-js/string-acronym/tree/umd
|
|
247
|
+
[umd-readme]: https://github.com/stdlib-js/string-acronym/blob/umd/README.md
|
|
235
248
|
[esm-url]: https://github.com/stdlib-js/string-acronym/tree/esm
|
|
249
|
+
[esm-readme]: https://github.com/stdlib-js/string-acronym/blob/esm/README.md
|
|
236
250
|
[branches-url]: https://github.com/stdlib-js/string-acronym/blob/main/branches.md
|
|
237
251
|
|
|
238
252
|
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/string-acronym/main/LICENSE
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/string-acronym-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Generate an acronym for a given string.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -25,21 +25,21 @@
|
|
|
25
25
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@stdlib/assert-is-regexp-string": "^0.0
|
|
29
|
-
"@stdlib/cli-ctor": "^0.0
|
|
30
|
-
"@stdlib/fs-read-file": "^0.0
|
|
31
|
-
"@stdlib/process-read-stdin": "^0.0
|
|
32
|
-
"@stdlib/regexp-eol": "^0.0
|
|
33
|
-
"@stdlib/streams-node-stdin": "^0.0
|
|
34
|
-
"@stdlib/string-trim": "^0.0
|
|
35
|
-
"@stdlib/utils-regexp-from-string": "^0.0
|
|
36
|
-
"@stdlib/string-acronym": "0.
|
|
28
|
+
"@stdlib/assert-is-regexp-string": "^0.2.0",
|
|
29
|
+
"@stdlib/cli-ctor": "^0.2.0",
|
|
30
|
+
"@stdlib/fs-read-file": "^0.2.0",
|
|
31
|
+
"@stdlib/process-read-stdin": "^0.2.0",
|
|
32
|
+
"@stdlib/regexp-eol": "^0.2.0",
|
|
33
|
+
"@stdlib/streams-node-stdin": "^0.2.0",
|
|
34
|
+
"@stdlib/string-trim": "^0.2.0",
|
|
35
|
+
"@stdlib/utils-regexp-from-string": "^0.2.0",
|
|
36
|
+
"@stdlib/string-acronym": "0.3.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@stdlib/assert-is-browser": "^0.0
|
|
40
|
-
"@stdlib/assert-is-windows": "^0.0
|
|
41
|
-
"@stdlib/process-exec-path": "^0.0
|
|
42
|
-
"@stdlib/string-replace": "^0.0
|
|
39
|
+
"@stdlib/assert-is-browser": "^0.2.0",
|
|
40
|
+
"@stdlib/assert-is-windows": "^0.2.0",
|
|
41
|
+
"@stdlib/process-exec-path": "^0.2.0",
|
|
42
|
+
"@stdlib/string-replace": "^0.2.0",
|
|
43
43
|
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
|
|
44
44
|
"proxyquire": "^2.0.0",
|
|
45
45
|
"istanbul": "^0.4.1",
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
#/
|
|
2
|
-
# @license Apache-2.0
|
|
3
|
-
#
|
|
4
|
-
# Copyright (c) 2023 The Stdlib Authors.
|
|
5
|
-
#
|
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
# you may not use this file except in compliance with the License.
|
|
8
|
-
# You may obtain a copy of the License at
|
|
9
|
-
#
|
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
#
|
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
# See the License for the specific language governing permissions and
|
|
16
|
-
# limitations under the License.
|
|
17
|
-
#/
|
|
18
|
-
|
|
19
|
-
# Workflow name:
|
|
20
|
-
name: publish_cli
|
|
21
|
-
|
|
22
|
-
# Workflow triggers:
|
|
23
|
-
on:
|
|
24
|
-
# Allow the workflow to be manually run:
|
|
25
|
-
workflow_dispatch:
|
|
26
|
-
# Workflow inputs:
|
|
27
|
-
inputs:
|
|
28
|
-
version:
|
|
29
|
-
description: 'Version Increment'
|
|
30
|
-
type: choice
|
|
31
|
-
default: 'none'
|
|
32
|
-
options:
|
|
33
|
-
- 'none'
|
|
34
|
-
- 'major'
|
|
35
|
-
- 'minor'
|
|
36
|
-
- 'patch'
|
|
37
|
-
- 'premajor'
|
|
38
|
-
- 'preminor'
|
|
39
|
-
- 'prepatch'
|
|
40
|
-
- 'prerelease'
|
|
41
|
-
|
|
42
|
-
# Workflow jobs:
|
|
43
|
-
jobs:
|
|
44
|
-
|
|
45
|
-
# Define job to publish package to npm:
|
|
46
|
-
publish:
|
|
47
|
-
|
|
48
|
-
# Define display name:
|
|
49
|
-
name: 'Publish CLI package to npm'
|
|
50
|
-
|
|
51
|
-
# Define the type of virtual host machine on which to run the job:
|
|
52
|
-
runs-on: ubuntu-latest
|
|
53
|
-
|
|
54
|
-
# Define environment variables:
|
|
55
|
-
env:
|
|
56
|
-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
57
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
58
|
-
|
|
59
|
-
# Define the sequence of job steps...
|
|
60
|
-
steps:
|
|
61
|
-
|
|
62
|
-
# Checkout cli branch:
|
|
63
|
-
- name: 'Checkout cli branch'
|
|
64
|
-
uses: actions/checkout@v3
|
|
65
|
-
with:
|
|
66
|
-
ref: cli
|
|
67
|
-
|
|
68
|
-
# Install Node.js:
|
|
69
|
-
- name: 'Install Node.js'
|
|
70
|
-
uses: actions/setup-node@v3
|
|
71
|
-
with:
|
|
72
|
-
node-version: 16
|
|
73
|
-
timeout-minutes: 5
|
|
74
|
-
|
|
75
|
-
# Configure git:
|
|
76
|
-
- name: 'Configure git'
|
|
77
|
-
run: |
|
|
78
|
-
git config --local user.email "noreply@stdlib.io"
|
|
79
|
-
git config --local user.name "stdlib-bot"
|
|
80
|
-
|
|
81
|
-
# Increment package version (if requested):
|
|
82
|
-
- name: 'Increment package version (if requested)'
|
|
83
|
-
if: ${{ github.event.inputs.version != 'none' }}
|
|
84
|
-
run: |
|
|
85
|
-
# Save NPM_TOKEN to user's .npmrc:
|
|
86
|
-
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
|
|
87
|
-
|
|
88
|
-
# Increment package version:
|
|
89
|
-
npm version ${{ github.event.inputs.version }} --no-git-tag-version
|
|
90
|
-
|
|
91
|
-
# Define variable for new version:
|
|
92
|
-
NEW_VERSION=$(node -p "require('./package.json').version")
|
|
93
|
-
|
|
94
|
-
# Replace branch in README.md link definitions for badges with the new version:
|
|
95
|
-
find . -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/branch([=:])[^ ]+/branch\1v${NEW_VERSION}/g"
|
|
96
|
-
|
|
97
|
-
# Create a new commit and tag:
|
|
98
|
-
git add package.json README.md
|
|
99
|
-
git commit -m "Release v${NEW_VERSION}"
|
|
100
|
-
git tag -a "v${NEW_VERSION}-cli" -m "Release v${NEW_VERSION}"
|
|
101
|
-
|
|
102
|
-
# Push changes to GitHub:
|
|
103
|
-
SLUG=${{ github.repository }}
|
|
104
|
-
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" --follow-tags
|
|
105
|
-
|
|
106
|
-
# Replace GitHub links to individual packages with npm links:
|
|
107
|
-
- name: 'Replace all GitHub links to individual packages with npm links'
|
|
108
|
-
run: |
|
|
109
|
-
find . -type f -name '*.md' -print0 | xargs -0 sed -Ei '/tree\/main/b; s/@stdlib\/([^:]*)\]: https:\/\/github.com\/stdlib-js/@stdlib\/\1\]: https:\/\/www.npmjs.com\/package\/@stdlib/g'
|
|
110
|
-
SLUG=${{ github.repository }}
|
|
111
|
-
ESCAPED_SLUG=${SLUG//\//\\\/}
|
|
112
|
-
REPO=${SLUG#*/}
|
|
113
|
-
find . -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/https:\/\/github.com\/${ESCAPED_SLUG}\/tree\/main/https:\/\/www.npmjs.com\/package\/@stdlib\/${REPO}/g"
|
|
114
|
-
|
|
115
|
-
# Publish package to npm:
|
|
116
|
-
- name: 'Publish package to npm'
|
|
117
|
-
uses: JS-DevTools/npm-publish@v1
|
|
118
|
-
with:
|
|
119
|
-
token: ${{ secrets.NPM_TOKEN }}
|
|
120
|
-
access: public
|
|
121
|
-
|
|
122
|
-
# Discard any uncommitted changes:
|
|
123
|
-
- name: 'Discard any uncommitted changes'
|
|
124
|
-
run: |
|
|
125
|
-
git reset --hard
|
|
126
|
-
|
|
127
|
-
# Send status to Slack channel if job fails:
|
|
128
|
-
- name: 'Send status to Slack channel in case of failure'
|
|
129
|
-
uses: act10ns/slack@v1
|
|
130
|
-
with:
|
|
131
|
-
status: ${{ job.status }}
|
|
132
|
-
steps: ${{ toJson(steps) }}
|
|
133
|
-
channel: '#npm-ci'
|
|
134
|
-
if: failure()
|
|
135
|
-
|
|
136
|
-
# Define job to cancel any running or queued workflow runs...
|
|
137
|
-
cancel:
|
|
138
|
-
|
|
139
|
-
# Define the type of virtual host machine on which to run the job:
|
|
140
|
-
runs-on: ubuntu-latest
|
|
141
|
-
|
|
142
|
-
# Time out the job after 3 minutes:
|
|
143
|
-
timeout-minutes: 3
|
|
144
|
-
|
|
145
|
-
# Define the sequence of job steps...
|
|
146
|
-
steps:
|
|
147
|
-
|
|
148
|
-
# Cancel any running or queued workflow runs:
|
|
149
|
-
- name: 'Cancel running or queued workflow runs'
|
|
150
|
-
uses: styfle/cancel-workflow-action@0.11.0
|
|
151
|
-
with:
|
|
152
|
-
workflow_id: >-
|
|
153
|
-
benchmark.yml,
|
|
154
|
-
examples.yml,
|
|
155
|
-
test.yml,
|
|
156
|
-
test_coverage.yml,
|
|
157
|
-
test_install.yml,
|
|
158
|
-
publish.yml
|
|
159
|
-
access_token: ${{ github.token }}
|
package/CONTRIBUTORS
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# This file is generated by tools/scripts/update_contributors.
|
|
2
|
-
#
|
|
3
|
-
# Contributors listed in alphabetical order.
|
|
4
|
-
|
|
5
|
-
Ali Salesi <ali_sal1381@yahoo.com>
|
|
6
|
-
Athan Reines <kgryte@gmail.com>
|
|
7
|
-
Brendan Graetz <bguiz@users.noreply.github.com>
|
|
8
|
-
Bruno Fenzl <brunofenzl@gmail.com>
|
|
9
|
-
Christopher Dambamuromo <chridam@gmail.com>
|
|
10
|
-
Dominik Moritz <domoritz@gmail.com>
|
|
11
|
-
Frank Kovacs <fran70kk@gmail.com>
|
|
12
|
-
James <jdgelok@gmail.com>
|
|
13
|
-
Jithin KS <jithinks112@gmail.com>
|
|
14
|
-
Joey Reed <joeyrreed@gmail.com>
|
|
15
|
-
Jordan-Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com>
|
|
16
|
-
Joris Labie <joris.labie1@gmail.com>
|
|
17
|
-
Justin Dennison <justin1dennison@gmail.com>
|
|
18
|
-
Marcus <mfantham@users.noreply.github.com>
|
|
19
|
-
Matt Cochrane <matthew.cochrane.eng@gmail.com>
|
|
20
|
-
Milan Raj <rajsite@users.noreply.github.com>
|
|
21
|
-
Momtchil Momtchev <momtchil@momtchev.com>
|
|
22
|
-
Ognjen Jevremović <ognjenjevremovic@users.noreply.github.com>
|
|
23
|
-
Philipp Burckhardt <pburckhardt@outlook.com>
|
|
24
|
-
Pranav <85227306+Pranavchiku@users.noreply.github.com>
|
|
25
|
-
Ricky Reusser <rsreusser@gmail.com>
|
|
26
|
-
Ryan Seal <splrk@users.noreply.github.com>
|
|
27
|
-
Seyyed Parsa Neshaei <spneshaei@users.noreply.github.com>
|
|
28
|
-
Shraddheya Shendre <shendreshraddheya@gmail.com>
|
|
29
|
-
Stephannie Jiménez Gacha <steff456@hotmail.com>
|
|
30
|
-
dorrin-sot <59933477+dorrin-sot@users.noreply.github.com>
|
|
31
|
-
rei2hu <rei2hu@users.noreply.github.com>
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Apache-2.0
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2021 The Stdlib Authors.
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
var proc = require( 'process' );
|
|
20
|
-
var resolve = require( 'path' ).resolve;
|
|
21
|
-
var proxyquire = require( 'proxyquire' );
|
|
22
|
-
|
|
23
|
-
var fpath = resolve( __dirname, '..', 'bin', 'cli' );
|
|
24
|
-
|
|
25
|
-
proc.stdin.isTTY = false;
|
|
26
|
-
|
|
27
|
-
proxyquire( fpath, {
|
|
28
|
-
'@stdlib/process-read-stdin': stdin
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
function stdin( clbk ) {
|
|
32
|
-
clbk( new Error( 'beep' ) );
|
|
33
|
-
}
|
package/test/test.cli.js
DELETED
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Apache-2.0
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2021 The Stdlib Authors.
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
'use strict';
|
|
20
|
-
|
|
21
|
-
// MODULES //
|
|
22
|
-
|
|
23
|
-
var resolve = require( 'path' ).resolve;
|
|
24
|
-
var exec = require( 'child_process' ).exec;
|
|
25
|
-
var tape = require( 'tape' );
|
|
26
|
-
var IS_BROWSER = require( '@stdlib/assert-is-browser' );
|
|
27
|
-
var IS_WINDOWS = require( '@stdlib/assert-is-windows' );
|
|
28
|
-
var EXEC_PATH = require( '@stdlib/process-exec-path' );
|
|
29
|
-
var replace = require( '@stdlib/string-replace' );
|
|
30
|
-
var readFileSync = require( '@stdlib/fs-read-file' ).sync;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// VARIABLES //
|
|
34
|
-
|
|
35
|
-
var fpath = resolve( __dirname, '..', 'bin', 'cli' );
|
|
36
|
-
var opts = {
|
|
37
|
-
'skip': IS_BROWSER || IS_WINDOWS
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// FIXTURES //
|
|
42
|
-
|
|
43
|
-
var PKG_VERSION = require( './../package.json' ).version;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// TESTS //
|
|
47
|
-
|
|
48
|
-
tape( 'command-line interface', function test( t ) {
|
|
49
|
-
t.ok( true, __filename );
|
|
50
|
-
t.end();
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) {
|
|
54
|
-
var expected;
|
|
55
|
-
var cmd;
|
|
56
|
-
|
|
57
|
-
expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), {
|
|
58
|
-
'encoding': 'utf8'
|
|
59
|
-
});
|
|
60
|
-
cmd = [
|
|
61
|
-
EXEC_PATH,
|
|
62
|
-
fpath,
|
|
63
|
-
'--help'
|
|
64
|
-
];
|
|
65
|
-
|
|
66
|
-
exec( cmd.join( ' ' ), done );
|
|
67
|
-
|
|
68
|
-
function done( error, stdout, stderr ) {
|
|
69
|
-
if ( error ) {
|
|
70
|
-
t.fail( error.message );
|
|
71
|
-
} else {
|
|
72
|
-
t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' );
|
|
73
|
-
t.strictEqual( stderr.toString(), expected+'\n', 'expected value' );
|
|
74
|
-
}
|
|
75
|
-
t.end();
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) {
|
|
80
|
-
var expected;
|
|
81
|
-
var cmd;
|
|
82
|
-
|
|
83
|
-
expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), {
|
|
84
|
-
'encoding': 'utf8'
|
|
85
|
-
});
|
|
86
|
-
cmd = [
|
|
87
|
-
EXEC_PATH,
|
|
88
|
-
fpath,
|
|
89
|
-
'-h'
|
|
90
|
-
];
|
|
91
|
-
|
|
92
|
-
exec( cmd.join( ' ' ), done );
|
|
93
|
-
|
|
94
|
-
function done( error, stdout, stderr ) {
|
|
95
|
-
if ( error ) {
|
|
96
|
-
t.fail( error.message );
|
|
97
|
-
} else {
|
|
98
|
-
t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' );
|
|
99
|
-
t.strictEqual( stderr.toString(), expected+'\n', 'expected value' );
|
|
100
|
-
}
|
|
101
|
-
t.end();
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) {
|
|
106
|
-
var cmd = [
|
|
107
|
-
EXEC_PATH,
|
|
108
|
-
fpath,
|
|
109
|
-
'--version'
|
|
110
|
-
];
|
|
111
|
-
|
|
112
|
-
exec( cmd.join( ' ' ), done );
|
|
113
|
-
|
|
114
|
-
function done( error, stdout, stderr ) {
|
|
115
|
-
if ( error ) {
|
|
116
|
-
t.fail( error.message );
|
|
117
|
-
} else {
|
|
118
|
-
t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' );
|
|
119
|
-
t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' );
|
|
120
|
-
}
|
|
121
|
-
t.end();
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) {
|
|
126
|
-
var cmd = [
|
|
127
|
-
EXEC_PATH,
|
|
128
|
-
fpath,
|
|
129
|
-
'-V'
|
|
130
|
-
];
|
|
131
|
-
|
|
132
|
-
exec( cmd.join( ' ' ), done );
|
|
133
|
-
|
|
134
|
-
function done( error, stdout, stderr ) {
|
|
135
|
-
if ( error ) {
|
|
136
|
-
t.fail( error.message );
|
|
137
|
-
} else {
|
|
138
|
-
t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' );
|
|
139
|
-
t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' );
|
|
140
|
-
}
|
|
141
|
-
t.end();
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
tape( 'the command-line interface generates an acronym for a supplied string', opts, function test( t ) {
|
|
146
|
-
var opts;
|
|
147
|
-
var cmd;
|
|
148
|
-
|
|
149
|
-
cmd = [
|
|
150
|
-
EXEC_PATH,
|
|
151
|
-
'-e',
|
|
152
|
-
'"process.stdin.isTTY = true; process.argv[ 2 ] = \'Test-Driven Development\'; require( \''+fpath+'\' );"'
|
|
153
|
-
];
|
|
154
|
-
opts = {};
|
|
155
|
-
|
|
156
|
-
exec( cmd.join( ' ' ), opts, done );
|
|
157
|
-
|
|
158
|
-
function done( error, stdout, stderr ) {
|
|
159
|
-
if ( error ) {
|
|
160
|
-
t.fail( error.message );
|
|
161
|
-
} else {
|
|
162
|
-
t.strictEqual( stdout.toString(), 'TDD\n', 'prints expected results to stdout' );
|
|
163
|
-
t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' );
|
|
164
|
-
}
|
|
165
|
-
t.end();
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) {
|
|
170
|
-
var cmd = [
|
|
171
|
-
'printf \'Test-driven Development\tAmerican Statistical Association\'',
|
|
172
|
-
'|',
|
|
173
|
-
EXEC_PATH,
|
|
174
|
-
fpath,
|
|
175
|
-
'--split \'\t\''
|
|
176
|
-
];
|
|
177
|
-
|
|
178
|
-
exec( cmd.join( ' ' ), done );
|
|
179
|
-
|
|
180
|
-
function done( error, stdout, stderr ) {
|
|
181
|
-
if ( error ) {
|
|
182
|
-
t.fail( error.message );
|
|
183
|
-
} else {
|
|
184
|
-
t.strictEqual( stdout.toString(), 'TDD\nASA\n', 'expected value' );
|
|
185
|
-
t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' );
|
|
186
|
-
}
|
|
187
|
-
t.end();
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) {
|
|
192
|
-
var cmd = [
|
|
193
|
-
'printf \'Test-driven Development\tAmerican Statistical Association\'',
|
|
194
|
-
'|',
|
|
195
|
-
EXEC_PATH,
|
|
196
|
-
fpath,
|
|
197
|
-
'--split=/\\\\t/'
|
|
198
|
-
];
|
|
199
|
-
|
|
200
|
-
exec( cmd.join( ' ' ), done );
|
|
201
|
-
|
|
202
|
-
function done( error, stdout, stderr ) {
|
|
203
|
-
if ( error ) {
|
|
204
|
-
t.fail( error.message );
|
|
205
|
-
} else {
|
|
206
|
-
t.strictEqual( stdout.toString(), 'TDD\nASA\n', 'expected value' );
|
|
207
|
-
t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' );
|
|
208
|
-
}
|
|
209
|
-
t.end();
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) {
|
|
214
|
-
var script;
|
|
215
|
-
var opts;
|
|
216
|
-
var cmd;
|
|
217
|
-
|
|
218
|
-
script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), {
|
|
219
|
-
'encoding': 'utf8'
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
// Replace single quotes with double quotes:
|
|
223
|
-
script = replace( script, '\'', '"' );
|
|
224
|
-
|
|
225
|
-
cmd = [
|
|
226
|
-
EXEC_PATH,
|
|
227
|
-
'-e',
|
|
228
|
-
'\''+script+'\''
|
|
229
|
-
];
|
|
230
|
-
|
|
231
|
-
opts = {
|
|
232
|
-
'cwd': __dirname
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
exec( cmd.join( ' ' ), opts, done );
|
|
236
|
-
|
|
237
|
-
function done( error, stdout, stderr ) {
|
|
238
|
-
if ( error ) {
|
|
239
|
-
t.pass( error.message );
|
|
240
|
-
t.strictEqual( error.code, 1, 'expected exit code' );
|
|
241
|
-
}
|
|
242
|
-
t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' );
|
|
243
|
-
t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' );
|
|
244
|
-
t.end();
|
|
245
|
-
}
|
|
246
|
-
});
|