diff --git a/JS/httpBinExcercise/httpExec.js b/JS/httpBinExcercise/httpExec.js new file mode 100644 index 00000000..ee0ad5f7 --- /dev/null +++ b/JS/httpBinExcercise/httpExec.js @@ -0,0 +1,44 @@ +//parallel run excercise +//for get uuid +async function getUuid(){ + console.time("getUuid Time") + const response = await fetch("https://httpbin.org/uuid") + console.timeEnd("getUuid Time") + const uuid = await response.json(); + return uuid.uuid; +} + +// getdelay +async function delay(delayData){ + console.time("Delay Time"); + const response = await fetch("https://httpbin.org/delay/5") + console.timeEnd("Delay Time"); + const delay = await response.json(); + return delay; +} + +//post +async function postAnything(uuid){ + const response = await fetch(`https://httpbin.org/anything`, { + method: "POST", + body: uuid, + }); + const data = await response.json() + return data +} + +async function main() { + console.time("TotalTime:") + + let uuid = getUuid(); + let delayRes = delay(); + console.time("Post time:") + let anything = await postAnything(await uuid); + console.log("data", anything.data); + console.timeEnd("Post time:") + + await delayRes + console.timeEnd("TotalTime:") + } + main(); + diff --git a/JS/node_modules/.bin/colors b/JS/node_modules/.bin/colors new file mode 120000 index 00000000..679e2508 --- /dev/null +++ b/JS/node_modules/.bin/colors @@ -0,0 +1 @@ +../colors-cli/bin/colors \ No newline at end of file diff --git a/JS/node_modules/.package-lock.json b/JS/node_modules/.package-lock.json new file mode 100644 index 00000000..7f3bb3db --- /dev/null +++ b/JS/node_modules/.package-lock.json @@ -0,0 +1,24 @@ +{ + "name": "execercise", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/colors-cli": { + "version": "1.0.32", + "resolved": "https://registry.npmjs.org/colors-cli/-/colors-cli-1.0.32.tgz", + "integrity": "sha512-zHMwyBeZ1PEo1sm11JA2SFw5/+5AB0aRBmQZbO8qOZ0bCeDEpoJDe+UZbG/oICiQ9/m6vLBd/3GASAP9GfSkwA==", + "bin": { + "colors": "bin/colors" + } + }, + "node_modules/loading-cli": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/loading-cli/-/loading-cli-1.1.0.tgz", + "integrity": "sha512-r6Kj0Y3d3isT4vvJ0tFlND1CcLkpatWmlgQs/PEfnSofJSHZwAbsqexnpQEDj4nlxSXEqFWh/Wu2iQXAAZRPNQ==", + "dependencies": { + "colors-cli": "^1.0.26" + } + } + } +} diff --git a/JS/node_modules/colors-cli/.github/FUNDING.yml b/JS/node_modules/colors-cli/.github/FUNDING.yml new file mode 100644 index 00000000..c4644e14 --- /dev/null +++ b/JS/node_modules/colors-cli/.github/FUNDING.yml @@ -0,0 +1,9 @@ +# These are supported funding model platforms + +github: [jaywcjlove] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/colors-cli +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +custom: https://jaywcjlove.github.io/sponsor.html diff --git a/JS/node_modules/colors-cli/.github/workflows/ci.yml b/JS/node_modules/colors-cli/.github/workflows/ci.yml new file mode 100644 index 00000000..d8c97098 --- /dev/null +++ b/JS/node_modules/colors-cli/.github/workflows/ci.yml @@ -0,0 +1,69 @@ +name: build +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: 'https://registry.npmjs.org' + + - run: mkdir -p build + - run: cp -rp img build + - run: npm i markdown-to-html-cli -g + - run: markdown-to-html --output build/index.html + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./build + + - run: npm run test + + - run: npm publish + name: colors-cli + continue-on-error: true + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Is a tag created auto? + id: create_tag + uses: jaywcjlove/create-tag-action@main + with: + token: ${{ secrets.GITHUB_TOKEN }} + package-path: ./package.json + + - name: Generate Changelog + id: changelog + uses: jaywcjlove/changelog-generator@main + if: steps.create_tag.outputs.successful + with: + token: ${{ secrets.GITHUB_TOKEN }} + head-ref: ${{ steps.create_tag.outputs.version }} + filter-author: (小弟调调™|Renovate Bot) + filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}' + + - name: Create Release + uses: ncipollo/release-action@v1 + if: steps.create_tag.outputs.successful + with: + token: ${{ secrets.GITHUB_TOKEN }} + name: ${{ steps.create_tag.outputs.version }} + tag: ${{ steps.create_tag.outputs.version }} + body: | + [![](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/colors-cli@${{steps.create_tag.outputs.versionNumber}}/file/README.md) + + ```bash + npm i colors-cli@${{steps.create_tag.outputs.versionNumber}} + ``` + + ${{ steps.changelog.outputs.compareurl }} + + ${{ steps.changelog.outputs.changelog }} diff --git a/JS/node_modules/colors-cli/README.md b/JS/node_modules/colors-cli/README.md new file mode 100644 index 00000000..681e513f --- /dev/null +++ b/JS/node_modules/colors-cli/README.md @@ -0,0 +1,194 @@ + + +# colors-cli + +[![](https://jaywcjlove.github.io/sb/ico/npm.svg)](https://www.npmjs.com/package/colors-cli) [![build](https://github.com/jaywcjlove/colors-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/jaywcjlove/colors-cli/actions/workflows/ci.yml) [![NPM Downloads](https://img.shields.io/npm/dm/colors-cli.svg?style=flat)](https://www.npmjs.com/package/colors-cli) + + +Terminal string styling done right. ಠ_ಠ + + + +Install with npm: + +```bash +npm install colors-cli --save-dev +``` + +# Styles + +`bold`、 `faint`、 `italic`、 `underline`、 `blink`、 `overline`、 `inverse`、 `conceal`、 `strike`、 + +# Colors + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ForegroundBackgroundBright ForegroundBright Background
blackblack_bblack_btblack_bbt
redred_bred_btred_bbt
greengreen_bgreen_btgreen_bbt
yellowyellow_byellow_btyellow_bbt
blueblue_bblue_btblue_bbt
magentamagenta_bmagenta_btmagenta_bbt
cyancyan_bcyan_btcyan_bbt
whitewhite_bwhite_btwhite_bbt
+ +## Basic usage: + +Output colored text: + +```js +var color = require('colors-cli') +console.log( color.red('hello') ) +``` + +Best way is to predefine needed stylings and then use it: + +```js +var color = require('colors-cli/safe') +var error = color.red.bold; +var warn = color.yellow; +var notice = color.blue; +console.log(error('Error!')); +console.log(warn('Warning')); +console.log(notice('Notice')); +``` + +Styles can be mixed: + +```js +var color = require('colors-cli/safe') +console.log('=>', color.red.bold.underline('hello') ) +console.log('=>', color.magenta_bt.underline('hello ' + color.blue_bt('wo' + color.yellow_bt.magenta_bbt('r') + 'ld') + ' !!!!')); +console.log('=>', color.magenta_bt.underline('hello ' + color.blue_bt('wo' + color.yellow_bt.magenta_bbt('r')))); +console.log('=>', color.magenta_bt.underline('hello ' + color.blue_bt('world') + ' !!!!' + color.yellow('kenny') + ' wong' )); + +var color = require('colors-cli/safe') +require('colors-cli/toxic') +console.log('=> ' + color.underline('$ ' + 'npm'.magenta.underline + ' install'.yellow.underline + ' colors-cli --save-dev')); +``` + + +```js +require('colors-cli/toxic') +console.log( 'hello'.green ); +console.log( 'hello'.green.black_b.underline ); +console.log('=> $'.green + ' npm '.magenta + 'install '.yellow + 'colors-cli'.cyan + ' --save-dev'); +``` + +# ANSI 256 colors + +Support ANSI 256 colors. [0 - 255], The rules of method name. + + - Foreground `x32` + - Background `xb32` + +```js +var color = require('colors-cli/safe') +console.log( color.x45.bold.underline('hello') ) + +require('colors-cli/toxic') +console.log( 'hello'.x23.underline ); +console.log( 'hello'.green.xb34.underline ); +``` + + + +### Use the command line + +```bash + Usage: colors + + Options: + + --black => black + --black_b => black_b + --red => red + ... + + Examples: + + colors --red "\nhello world" --bold,underline,yellow "wcj" + colors --green,bold "\nhello world" + colors --x12,bold "hello world" +``` + + +# Reference + +- [The opaque named colors](https://drafts.csswg.org/css-color/#named-colors) +- [ANSI escape code](https://en.wikipedia.org/wiki/ANSI_escape_code) + + +The [ANSI Escape](https://en.wikipedia.org/wiki/ANSI_escape_code) sequences control code screen. + +```bash +echo -e "\033[31;41;4m something here 33[0m" +``` + +`\033` As the escape character, inform the terminal to switch to the escape mode. +`[` The beginning of the CSI. +`m` Make the action to be performed. +`;` ASCII code separator. + +# License + +Licensed under the MIT License. \ No newline at end of file diff --git a/JS/node_modules/colors-cli/bin/colors b/JS/node_modules/colors-cli/bin/colors new file mode 100755 index 00000000..e5f01780 --- /dev/null +++ b/JS/node_modules/colors-cli/bin/colors @@ -0,0 +1,142 @@ +#!/usr/bin/env node +var colors = require('../'); +var args = process.argv.slice(2); +var _Colors = new colors.Colors() + +var styles = ''; +var scripts = ''; +var output = ''; +var help = false; +var log = console.log; + +colors.toxic(); + +args.filter(function (arg) { + if (arg === '-h' || arg === '--help') { + help = true; + }else if(/\-\-/.test(arg)){ + styles = arg.replace('--','').split(','); + }else{ + for (var i = 0; i < styles.length; i++) { + _Colors.string = arg; + if(styles[i]) scripts = _Colors[styles[i]].valueOf(); + } + output += scripts; + } +}); + +if (args && args.length === 0) { + help= true; +} + +var _styles = require('../lib/styles-name') +var colors_name = _styles.colors; +var styles_name = _styles.styles; + +if (help) { + log('') + log('\33[2J') // 清屏 + log(' Usage: colors') + log('') + log(' Options:') + log('') + + log(' 1.Colors Number'); + log(); + for (var i = 0; i < 256; i++) { + if (i !== 0 && i % 16 === 0) { + log(); + process.stdout.write(' '); + } + if(i === 0)process.stdout.write(' '); + var c = new colors.Colors(wordwrap(i)); + c.fgcolor_x = i; + process.stdout.write(c.valueOf()); + } + log(); + + + log("") + log(" 2.styles:") + log("") + + styles_name.forEach(function(key) { + process.stdout.write(" "+key[key]) + // log(key[key].red) + }); + + log("") + log("") + log(" 3.colors:") + log("") + + colors_name.forEach(function(key) { + process.stdout.write(" "+key[key]) + }); + + log("") + log("") + log(" 4.background colors:") + log("") + + colors_name.forEach(function(key) { + // process.stdout.write(" "+key[key+'_b']) + process.stdout.write(" "+eval( '"' +key+"_b"+ ' ".'+key+"_b")) + }); + + + log("") + log("") + log(" 5.Font Bright Color:") + log("") + + colors_name.forEach(function(key) { + // process.stdout.write(" "+key[key+'_bt']) + process.stdout.write(" "+eval( '"' +key+"_bt"+ ' ".'+key+"_bt")) + }); + + + log("") + log("") + log(" 6.Background Bright Color:") + log("") + + colors_name.forEach(function(key) { + // process.stdout.write(" "+key[key+'_bbt']) + process.stdout.write(" "+eval( '" ' +key+"_bbt"+ ' ".'+key+"_bbt")) + }); + + + + log('') + log('') + log(' Examples:') + log('') + log(' colors --red "\\nhello world" --bold,underline,yellow "wcj"') + log(' colors --green,bold "\\nhello world"') + log(' colors --x12,bold "hello world"') + log('') + +}else{ + log(output); +} + + +function wordwrap(i) { + i = String(i) + return i + new Array(5 - i.length).join(' '); +} + + +// var fs = require('fs'); +// var read = fs.createReadStream; +// var write = fs.createWriteStream; +// var dest = args[2] ? write(args[2]) : process.stdout +// var source = args[1] ? read(args[1]) : process.stdin + + +// var str = source.on('end', function (es,ss) { +// dest.write('---12:',es,str) +// }).pipe(dest, {end: false}) + +// log("args:",str) diff --git a/JS/node_modules/colors-cli/build/img/256_color.png b/JS/node_modules/colors-cli/build/img/256_color.png new file mode 100644 index 00000000..cd06066a Binary files /dev/null and b/JS/node_modules/colors-cli/build/img/256_color.png differ diff --git a/JS/node_modules/colors-cli/build/img/black.png b/JS/node_modules/colors-cli/build/img/black.png new file mode 100644 index 00000000..cf671d13 Binary files /dev/null and b/JS/node_modules/colors-cli/build/img/black.png differ diff --git a/JS/node_modules/colors-cli/build/img/black_bright.png b/JS/node_modules/colors-cli/build/img/black_bright.png new file mode 100644 index 00000000..e88d545a Binary files /dev/null and b/JS/node_modules/colors-cli/build/img/black_bright.png differ diff --git a/JS/node_modules/colors-cli/build/img/blue.png b/JS/node_modules/colors-cli/build/img/blue.png new file mode 100644 index 00000000..16378eca Binary files /dev/null and b/JS/node_modules/colors-cli/build/img/blue.png differ diff --git a/JS/node_modules/colors-cli/build/img/blue_bright.png b/JS/node_modules/colors-cli/build/img/blue_bright.png new file mode 100644 index 00000000..5da01370 Binary files /dev/null and b/JS/node_modules/colors-cli/build/img/blue_bright.png differ diff --git a/JS/node_modules/colors-cli/build/img/colors-cli.png b/JS/node_modules/colors-cli/build/img/colors-cli.png new file mode 100644 index 00000000..85581f02 Binary files /dev/null and b/JS/node_modules/colors-cli/build/img/colors-cli.png differ diff --git a/JS/node_modules/colors-cli/build/img/cyan.png b/JS/node_modules/colors-cli/build/img/cyan.png new file mode 100644 index 00000000..815e9d28 Binary files /dev/null and b/JS/node_modules/colors-cli/build/img/cyan.png differ diff --git a/JS/node_modules/colors-cli/build/img/cyan_bright.png b/JS/node_modules/colors-cli/build/img/cyan_bright.png new file mode 100644 index 00000000..b9a33c52 Binary files /dev/null and b/JS/node_modules/colors-cli/build/img/cyan_bright.png differ diff --git a/JS/node_modules/colors-cli/build/img/green.png b/JS/node_modules/colors-cli/build/img/green.png new file mode 100644 index 00000000..18b59be4 Binary files /dev/null and b/JS/node_modules/colors-cli/build/img/green.png differ diff --git a/JS/node_modules/colors-cli/build/img/green_bright.png b/JS/node_modules/colors-cli/build/img/green_bright.png new file mode 100644 index 00000000..97fcf889 Binary files /dev/null and b/JS/node_modules/colors-cli/build/img/green_bright.png differ diff --git a/JS/node_modules/colors-cli/build/img/magenta.png b/JS/node_modules/colors-cli/build/img/magenta.png new file mode 100644 index 00000000..824a2f07 Binary files /dev/null and b/JS/node_modules/colors-cli/build/img/magenta.png differ diff --git a/JS/node_modules/colors-cli/build/img/magenta_bright.png b/JS/node_modules/colors-cli/build/img/magenta_bright.png new file mode 100644 index 00000000..5787739b Binary files /dev/null and b/JS/node_modules/colors-cli/build/img/magenta_bright.png differ diff --git a/JS/node_modules/colors-cli/build/img/red.png b/JS/node_modules/colors-cli/build/img/red.png new file mode 100644 index 00000000..342c8031 Binary files /dev/null and b/JS/node_modules/colors-cli/build/img/red.png differ diff --git a/JS/node_modules/colors-cli/build/img/red_bright.png b/JS/node_modules/colors-cli/build/img/red_bright.png new file mode 100644 index 00000000..a7045ed3 Binary files /dev/null and b/JS/node_modules/colors-cli/build/img/red_bright.png differ diff --git a/JS/node_modules/colors-cli/build/img/screenshot.png b/JS/node_modules/colors-cli/build/img/screenshot.png new file mode 100644 index 00000000..2d3fe010 Binary files /dev/null and b/JS/node_modules/colors-cli/build/img/screenshot.png differ diff --git a/JS/node_modules/colors-cli/build/img/white.png b/JS/node_modules/colors-cli/build/img/white.png new file mode 100644 index 00000000..17e8dad7 Binary files /dev/null and b/JS/node_modules/colors-cli/build/img/white.png differ diff --git a/JS/node_modules/colors-cli/build/img/white_bright.png b/JS/node_modules/colors-cli/build/img/white_bright.png new file mode 100644 index 00000000..5514ad40 Binary files /dev/null and b/JS/node_modules/colors-cli/build/img/white_bright.png differ diff --git a/JS/node_modules/colors-cli/build/img/yellow.png b/JS/node_modules/colors-cli/build/img/yellow.png new file mode 100644 index 00000000..c1f22253 Binary files /dev/null and b/JS/node_modules/colors-cli/build/img/yellow.png differ diff --git a/JS/node_modules/colors-cli/build/img/yellow_bright.png b/JS/node_modules/colors-cli/build/img/yellow_bright.png new file mode 100644 index 00000000..de477cbf Binary files /dev/null and b/JS/node_modules/colors-cli/build/img/yellow_bright.png differ diff --git a/JS/node_modules/colors-cli/build/index.html b/JS/node_modules/colors-cli/build/index.html new file mode 100644 index 00000000..4246da44 --- /dev/null +++ b/JS/node_modules/colors-cli/build/index.html @@ -0,0 +1,337 @@ + + + + + colors-cli + + + + + +

colors-cli

+

build NPM Downloads

+

Terminal string styling done right. ಠ_ಠ

+

Install with npm:

+
npm install colors-cli --save-dev
+
+

Styles

+

boldfaintitalicunderlineblinkoverlineinverseconcealstrike

+

Colors

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ForegroundBackgroundBright ForegroundBright Background
blackblack_bblack_btblack_bbt
redred_bred_btred_bbt
greengreen_bgreen_btgreen_bbt
yellowyellow_byellow_btyellow_bbt
blueblue_bblue_btblue_bbt
magentamagenta_bmagenta_btmagenta_bbt
cyancyan_bcyan_btcyan_bbt
whitewhite_bwhite_btwhite_bbt
+

Basic usage:

+

Output colored text:

+
var color = require('colors-cli')
+console.log( color.red('hello') )
+
+

Best way is to predefine needed stylings and then use it:

+
var color = require('colors-cli/safe')
+var error = color.red.bold;
+var warn = color.yellow;
+var notice = color.blue;
+console.log(error('Error!'));
+console.log(warn('Warning'));
+console.log(notice('Notice'));
+
+

Styles can be mixed:

+
var color = require('colors-cli/safe')
+console.log('=>', color.red.bold.underline('hello') )
+console.log('=>', color.magenta_bt.underline('hello ' + color.blue_bt('wo' + color.yellow_bt.magenta_bbt('r') + 'ld') + ' !!!!'));
+console.log('=>', color.magenta_bt.underline('hello ' + color.blue_bt('wo' + color.yellow_bt.magenta_bbt('r'))));
+console.log('=>', color.magenta_bt.underline('hello ' + color.blue_bt('world') + ' !!!!' + color.yellow('kenny') + ' wong' ));
+
+var color = require('colors-cli/safe')
+require('colors-cli/toxic')
+console.log('=> ' + color.underline('$ ' + 'npm'.magenta.underline + ' install'.yellow.underline + ' colors-cli --save-dev'));
+
+
require('colors-cli/toxic')
+console.log( 'hello'.green );
+console.log( 'hello'.green.black_b.underline );
+console.log('=> $'.green + ' npm '.magenta + 'install '.yellow + 'colors-cli'.cyan + ' --save-dev');
+
+

ANSI 256 colors

+

Support ANSI 256 colors. [0 - 255], The rules of method name.

+ +
var color = require('colors-cli/safe')
+console.log( color.x45.bold.underline('hello') )
+
+require('colors-cli/toxic')
+console.log( 'hello'.x23.underline );
+console.log( 'hello'.green.xb34.underline );
+
+

Use the command line

+
 Usage: colors
+
+ Options:
+
+   --black  => black
+   --black_b  => black_b
+   --red  => red
+   ...
+
+ Examples:
+
+   colors --red "\nhello world" --bold,underline,yellow "wcj"
+   colors --green,bold "\nhello world"
+   colors --x12,bold "hello world"
+
+

Reference

+ +

The ANSI Escape sequences control code screen.

+
echo -e "\033[31;41;4m something here 33[0m"
+
+

\033 As the escape character, inform the terminal to switch to the escape mode.
[ The beginning of the CSI.
m Make the action to be performed.
; ASCII code separator.

+

License

+

Licensed under the MIT License.

+
+ + \ No newline at end of file diff --git a/JS/node_modules/colors-cli/index.d.ts b/JS/node_modules/colors-cli/index.d.ts new file mode 100644 index 00000000..2df6bc75 --- /dev/null +++ b/JS/node_modules/colors-cli/index.d.ts @@ -0,0 +1,305 @@ +import { Color } from './lib/color'; + + +export const black_bbt: Color; +export const red_bbt: Color; +export const green_bbt: Color; +export const yellow_bbt: Color; +export const blue_bbt: Color; +export const magenta_bbt: Color; +export const cyan_bbt: Color; +export const white_bbt: Color; + +export const black_bt: Color; +export const red_bt: Color; +export const green_bt: Color; +export const yellow_bt: Color; +export const blue_bt: Color; +export const magenta_bt: Color; +export const cyan_bt: Color; +export const white_bt: Color; + +export const black_b: Color; +export const red_b: Color; +export const green_b: Color; +export const yellow_b: Color; +export const blue_b: Color; +export const magenta_b: Color; +export const cyan_b: Color; +export const white_b: Color; + +export const black: Color; +export const red: Color; +export const green: Color; +export const yellow: Color; +export const blue: Color; +export const magenta: Color; +export const cyan: Color; +export const white: Color; + +export const bold: Color; +export const faint: Color; +export const italic: Color; +export const underline: Color; +export const blink: Color; +export const overline: Color; +export const inverse: Color; +export const conceal: Color; +export const strike: Color; + +export const x0: Color; +export const x1: Color; +export const x2: Color; +export const x3: Color; +export const x4: Color; +export const x5: Color; +export const x6: Color; +export const x7: Color; +export const x8: Color; +export const x9: Color; +export const x10: Color; +export const x11: Color; +export const x12: Color; +export const x13: Color; +export const x14: Color; +export const x15: Color; +export const x16: Color; +export const x17: Color; +export const x18: Color; +export const x19: Color; +export const x20: Color; +export const x21: Color; +export const x22: Color; +export const x23: Color; +export const x24: Color; +export const x25: Color; +export const x26: Color; +export const x27: Color; +export const x28: Color; +export const x29: Color; +export const x30: Color; +export const x31: Color; +export const x32: Color; +export const x33: Color; +export const x34: Color; +export const x35: Color; +export const x36: Color; +export const x37: Color; +export const x38: Color; +export const x39: Color; +export const x40: Color; +export const x41: Color; +export const x42: Color; +export const x43: Color; +export const x44: Color; +export const x45: Color; +export const x46: Color; +export const x47: Color; +export const x48: Color; +export const x49: Color; +export const x50: Color; +export const x51: Color; +export const x52: Color; +export const x53: Color; +export const x54: Color; +export const x55: Color; +export const x56: Color; +export const x57: Color; +export const x58: Color; +export const x59: Color; +export const x60: Color; +export const x61: Color; +export const x62: Color; +export const x63: Color; +export const x64: Color; +export const x65: Color; +export const x66: Color; +export const x67: Color; +export const x68: Color; +export const x69: Color; +export const x70: Color; +export const x71: Color; +export const x72: Color; +export const x73: Color; +export const x74: Color; +export const x75: Color; +export const x76: Color; +export const x77: Color; +export const x78: Color; +export const x79: Color; +export const x80: Color; +export const x81: Color; +export const x82: Color; +export const x83: Color; +export const x84: Color; +export const x85: Color; +export const x86: Color; +export const x87: Color; +export const x88: Color; +export const x89: Color; +export const x90: Color; +export const x91: Color; +export const x92: Color; +export const x93: Color; +export const x94: Color; +export const x95: Color; +export const x96: Color; +export const x97: Color; +export const x98: Color; +export const x99: Color; +export const x100: Color; +export const x101: Color; +export const x102: Color; +export const x103: Color; +export const x104: Color; +export const x105: Color; +export const x106: Color; +export const x107: Color; +export const x108: Color; +export const x109: Color; +export const x110: Color; +export const x111: Color; +export const x112: Color; +export const x113: Color; +export const x114: Color; +export const x115: Color; +export const x116: Color; +export const x117: Color; +export const x118: Color; +export const x119: Color; +export const x120: Color; +export const x121: Color; +export const x122: Color; +export const x123: Color; +export const x124: Color; +export const x125: Color; +export const x126: Color; +export const x127: Color; +export const x128: Color; +export const x129: Color; +export const x130: Color; +export const x131: Color; +export const x132: Color; +export const x133: Color; +export const x134: Color; +export const x135: Color; +export const x136: Color; +export const x137: Color; +export const x138: Color; +export const x139: Color; +export const x140: Color; +export const x141: Color; +export const x142: Color; +export const x143: Color; +export const x144: Color; +export const x145: Color; +export const x146: Color; +export const x147: Color; +export const x148: Color; +export const x149: Color; +export const x150: Color; +export const x151: Color; +export const x152: Color; +export const x153: Color; +export const x154: Color; +export const x155: Color; +export const x156: Color; +export const x157: Color; +export const x158: Color; +export const x159: Color; +export const x160: Color; +export const x161: Color; +export const x162: Color; +export const x163: Color; +export const x164: Color; +export const x165: Color; +export const x166: Color; +export const x167: Color; +export const x168: Color; +export const x169: Color; +export const x170: Color; +export const x171: Color; +export const x172: Color; +export const x173: Color; +export const x174: Color; +export const x175: Color; +export const x176: Color; +export const x177: Color; +export const x178: Color; +export const x179: Color; +export const x180: Color; +export const x181: Color; +export const x182: Color; +export const x183: Color; +export const x184: Color; +export const x185: Color; +export const x186: Color; +export const x187: Color; +export const x188: Color; +export const x189: Color; +export const x190: Color; +export const x191: Color; +export const x192: Color; +export const x193: Color; +export const x194: Color; +export const x195: Color; +export const x196: Color; +export const x197: Color; +export const x198: Color; +export const x199: Color; +export const x200: Color; +export const x201: Color; +export const x202: Color; +export const x203: Color; +export const x204: Color; +export const x205: Color; +export const x206: Color; +export const x207: Color; +export const x208: Color; +export const x209: Color; +export const x210: Color; +export const x211: Color; +export const x212: Color; +export const x213: Color; +export const x214: Color; +export const x215: Color; +export const x216: Color; +export const x217: Color; +export const x218: Color; +export const x219: Color; +export const x220: Color; +export const x221: Color; +export const x222: Color; +export const x223: Color; +export const x224: Color; +export const x225: Color; +export const x226: Color; +export const x227: Color; +export const x228: Color; +export const x229: Color; +export const x230: Color; +export const x231: Color; +export const x232: Color; +export const x233: Color; +export const x234: Color; +export const x235: Color; +export const x236: Color; +export const x237: Color; +export const x238: Color; +export const x239: Color; +export const x240: Color; +export const x241: Color; +export const x242: Color; +export const x243: Color; +export const x244: Color; +export const x245: Color; +export const x246: Color; +export const x247: Color; +export const x248: Color; +export const x249: Color; +export const x250: Color; +export const x251: Color; +export const x252: Color; +export const x253: Color; +export const x254: Color; +export const x255: Color; diff --git a/JS/node_modules/colors-cli/lib/ansi-regex.js b/JS/node_modules/colors-cli/lib/ansi-regex.js new file mode 100644 index 00000000..23871894 --- /dev/null +++ b/JS/node_modules/colors-cli/lib/ansi-regex.js @@ -0,0 +1,9 @@ +// https://github.com/chalk/ansi-regex/blob/master/index.js + +module.exports = function () { + const pattern = [ + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))' + ].join('|'); + return new RegExp(pattern, 'g'); +}; diff --git a/JS/node_modules/colors-cli/lib/color-name.js b/JS/node_modules/colors-cli/lib/color-name.js new file mode 100644 index 00000000..5a0a5288 --- /dev/null +++ b/JS/node_modules/colors-cli/lib/color-name.js @@ -0,0 +1,158 @@ +/** + * 不透明的颜色命名, + * 对应的RGB + * + * https://drafts.csswg.org/css-color/#named-colors + * + */ + +module.exports = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], + "aquamarine": [127, 255, 212], + "azure": [240, 255, 255], + "beige": [245, 245, 220], + "bisque": [255, 228, 196], + "black": [0, 0, 0], + "blanchedalmond": [255, 235, 205], + "blue": [0, 0, 255], + "blueviolet": [138, 43, 226], + "brown": [165, 42, 42], + "burlywood": [222, 184, 135], + "cadetblue": [95, 158, 160], + "chartreuse": [127, 255, 0], + "chocolate": [210, 105, 30], + "coral": [255, 127, 80], + "cornflowerblue": [100, 149, 237], + "cornsilk": [255, 248, 220], + "crimson": [220, 20, 60], + "cyan": [0, 255, 255], + "darkblue": [0, 0, 139], + "darkcyan": [0, 139, 139], + "darkgoldenrod": [184, 134, 11], + "darkgray": [169, 169, 169], + "darkgreen": [0, 100, 0], + "darkgrey": [169, 169, 169], + "darkkhaki": [189, 183, 107], + "darkmagenta": [139, 0, 139], + "darkolivegreen": [85, 107, 47], + "darkorange": [255, 140, 0], + "darkorchid": [153, 50, 204], + "darkred": [139, 0, 0], + "darksalmon": [233, 150, 122], + "darkseagreen": [143, 188, 143], + "darkslateblue": [72, 61, 139], + "darkslategray": [47, 79, 79], + "darkslategrey": [47, 79, 79], + "darkturquoise": [0, 206, 209], + "darkviolet": [148, 0, 211], + "deeppink": [255, 20, 147], + "deepskyblue": [0, 191, 255], + "dimgray": [105, 105, 105], + "dimgrey": [105, 105, 105], + "dodgerblue": [30, 144, 255], + "firebrick": [178, 34, 34], + "floralwhite": [255, 250, 240], + "forestgreen": [34, 139, 34], + "fuchsia": [255, 0, 255], + "gainsboro": [220, 220, 220], + "ghostwhite": [248, 248, 255], + "gold": [255, 215, 0], + "goldenrod": [218, 165, 32], + "gray": [128, 128, 128], + "green": [0, 128, 0], + "greenyellow": [173, 255, 47], + "grey": [128, 128, 128], + "honeydew": [240, 255, 240], + "hotpink": [255, 105, 180], + "indianred": [205, 92, 92], + "indigo": [75, 0, 130], + "ivory": [255, 255, 240], + "khaki": [240, 230, 140], + "lavender": [230, 230, 250], + "lavenderblush": [255, 240, 245], + "lawngreen": [124, 252, 0], + "lemonchiffon": [255, 250, 205], + "lightblue": [173, 216, 230], + "lightcoral": [240, 128, 128], + "lightcyan": [224, 255, 255], + "lightgoldenrodyellow": [250, 250, 210], + "lightgray": [211, 211, 211], + "lightgreen": [144, 238, 144], + "lightgrey": [211, 211, 211], + "lightpink": [255, 182, 193], + "lightsalmon": [255, 160, 122], + "lightseagreen": [32, 178, 170], + "lightskyblue": [135, 206, 250], + "lightslategray": [119, 136, 153], + "lightslategrey": [119, 136, 153], + "lightsteelblue": [176, 196, 222], + "lightyellow": [255, 255, 224], + "lime": [0, 255, 0], + "limegreen": [50, 205, 50], + "linen": [250, 240, 230], + "magenta": [255, 0, 255], + "maroon": [128, 0, 0], + "mediumaquamarine": [102, 205, 170], + "mediumblue": [0, 0, 205], + "mediumorchid": [186, 85, 211], + "mediumpurple": [147, 112, 219], + "mediumseagreen": [60, 179, 113], + "mediumslateblue": [123, 104, 238], + "mediumspringgreen": [0, 250, 154], + "mediumturquoise": [72, 209, 204], + "mediumvioletred": [199, 21, 133], + "midnightblue": [25, 25, 112], + "mintcream": [245, 255, 250], + "mistyrose": [255, 228, 225], + "moccasin": [255, 228, 181], + "navajowhite": [255, 222, 173], + "navy": [0, 0, 128], + "oldlace": [253, 245, 230], + "olive": [128, 128, 0], + "olivedrab": [107, 142, 35], + "orange": [255, 165, 0], + "orangered": [255, 69, 0], + "orchid": [218, 112, 214], + "palegoldenrod": [238, 232, 170], + "palegreen": [152, 251, 152], + "paleturquoise": [175, 238, 238], + "palevioletred": [219, 112, 147], + "papayawhip": [255, 239, 213], + "peachpuff": [255, 218, 185], + "peru": [205, 133, 63], + "pink": [255, 192, 203], + "plum": [221, 160, 221], + "powderblue": [176, 224, 230], + "purple": [128, 0, 128], + "rebeccapurple": [102, 51, 153], + "red": [255, 0, 0], + "rosybrown": [188, 143, 143], + "royalblue": [65, 105, 225], + "saddlebrown": [139, 69, 19], + "salmon": [250, 128, 114], + "sandybrown": [244, 164, 96], + "seagreen": [46, 139, 87], + "seashell": [255, 245, 238], + "sienna": [160, 82, 45], + "silver": [192, 192, 192], + "skyblue": [135, 206, 235], + "slateblue": [106, 90, 205], + "slategray": [112, 128, 144], + "slategrey": [112, 128, 144], + "snow": [255, 250, 250], + "springgreen": [0, 255, 127], + "steelblue": [70, 130, 180], + "tan": [210, 180, 140], + "teal": [0, 128, 128], + "thistle": [216, 191, 216], + "tomato": [255, 99, 71], + "turquoise": [64, 224, 208], + "violet": [238, 130, 238], + "wheat": [245, 222, 179], + "white": [255, 255, 255], + "whitesmoke": [245, 245, 245], + "yellow": [255, 255, 0], + "yellowgreen": [154, 205, 50] +}; diff --git a/JS/node_modules/colors-cli/lib/color-safe.js b/JS/node_modules/colors-cli/lib/color-safe.js new file mode 100644 index 00000000..c960ea9a --- /dev/null +++ b/JS/node_modules/colors-cli/lib/color-safe.js @@ -0,0 +1,89 @@ +var colors = {}; +module.exports = colors; + +var defineProps = Object.defineProperties; +var styles_data = require('./styles-name') +var ansiRegex = require('./ansi-regex'); +var ansiColors = styles_data.colors; +var ansiStyles = styles_data.styles; + +var Colors = require('./color').Colors +var color = require('./color').color + +// Get all the color attribute. +ansiColors = Object.keys(color) + +var styles = (function () { + var ret = {}; + var retarr = ansiStyles.concat(ansiColors) + retarr.forEach(function (key) { + ret[key] = { + get: function () { + return build(this._styles.concat(key)); + } + }; + }); + return ret; +})(); + +var proto = defineProps(function colors() {}, styles); + + +function build(_styles_more) { + var builder = function builder() { + return applyStyle.apply(builder, arguments); + }; + builder._styles = _styles_more; + // 使用它 __proto__ 是必须返回一个函数 + builder.__proto__ = proto; + return builder; +} + +function applyStyleCallback(str, _sty) { + var _Colors = new Colors() + for (var i = 0; i < _sty.length; i++) { + _Colors.string = str; + if (_sty[i]) str = _Colors[_sty[i]].valueOf(_sty[i]); + } + return str; +} + +function regexReplace(str) { + return str.replace(/(\[)/ig, '\\[').replace(/(\])/ig, '\\]'); +} + +// 应用 Ansi 样式 +function applyStyle(){ + var args_len = arguments.length; + var str = args_len !== 0 && String(arguments[0]); + var _sty = this._styles; + var ansiArray = str.match(ansiRegex()); + // 文本中是否带 ANSI 控制码 + if (ansiRegex().test(str) && ansiArray) { + var leftReg = regexReplace(ansiArray[0]); + var rightReg = regexReplace(ansiArray[ansiArray.length - 1]); + var centerReg = new RegExp(leftReg + '(.*)' + rightReg, "g"); + var centerStr = str.match(centerReg); + var sidesStr = str.split(centerStr); + str = applyStyleCallback(sidesStr[0], _sty) + centerStr + applyStyleCallback(sidesStr[1], _sty); + } else { + str = applyStyleCallback(str, _sty); + } + return str; +} + +function init() { + var ret = {}; + Object.keys(styles).forEach(function (name) { + ret[name] = { + get: function () { + return build([name]); + } + }; + }); + return ret; +} + +defineProps(colors, init()); + + diff --git a/JS/node_modules/colors-cli/lib/color.d.ts b/JS/node_modules/colors-cli/lib/color.d.ts new file mode 100644 index 00000000..a9a8f385 --- /dev/null +++ b/JS/node_modules/colors-cli/lib/color.d.ts @@ -0,0 +1,609 @@ +export interface Color { + (text: string): string; + + black_bbt: Color; + red_bbt: Color; + green_bbt: Color; + yellow_bbt: Color; + blue_bbt: Color; + magenta_bbt: Color; + cyan_bbt: Color; + white_bbt: Color; + + black_bt: Color; + red_bt: Color; + green_bt: Color; + yellow_bt: Color; + blue_bt: Color; + magenta_bt: Color; + cyan_bt: Color; + white_bt: Color; + + black_b: Color; + red_b: Color; + green_b: Color; + yellow_b: Color; + blue_b: Color; + magenta_b: Color; + cyan_b: Color; + white_b: Color; + + black: Color; + red: Color; + green: Color; + yellow: Color; + blue: Color; + magenta: Color; + cyan: Color; + white: Color; + + bold: Color; + faint: Color; + italic: Color; + underline: Color; + blink: Color; + overline: Color; + inverse: Color; + conceal: Color; + strike: Color; + + x0: Color; + x1: Color; + x2: Color; + x3: Color; + x4: Color; + x5: Color; + x6: Color; + x7: Color; + x8: Color; + x9: Color; + x10: Color; + x11: Color; + x12: Color; + x13: Color; + x14: Color; + x15: Color; + x16: Color; + x17: Color; + x18: Color; + x19: Color; + x20: Color; + x21: Color; + x22: Color; + x23: Color; + x24: Color; + x25: Color; + x26: Color; + x27: Color; + x28: Color; + x29: Color; + x30: Color; + x31: Color; + x32: Color; + x33: Color; + x34: Color; + x35: Color; + x36: Color; + x37: Color; + x38: Color; + x39: Color; + x40: Color; + x41: Color; + x42: Color; + x43: Color; + x44: Color; + x45: Color; + x46: Color; + x47: Color; + x48: Color; + x49: Color; + x50: Color; + x51: Color; + x52: Color; + x53: Color; + x54: Color; + x55: Color; + x56: Color; + x57: Color; + x58: Color; + x59: Color; + x60: Color; + x61: Color; + x62: Color; + x63: Color; + x64: Color; + x65: Color; + x66: Color; + x67: Color; + x68: Color; + x69: Color; + x70: Color; + x71: Color; + x72: Color; + x73: Color; + x74: Color; + x75: Color; + x76: Color; + x77: Color; + x78: Color; + x79: Color; + x80: Color; + x81: Color; + x82: Color; + x83: Color; + x84: Color; + x85: Color; + x86: Color; + x87: Color; + x88: Color; + x89: Color; + x90: Color; + x91: Color; + x92: Color; + x93: Color; + x94: Color; + x95: Color; + x96: Color; + x97: Color; + x98: Color; + x99: Color; + x100: Color; + x101: Color; + x102: Color; + x103: Color; + x104: Color; + x105: Color; + x106: Color; + x107: Color; + x108: Color; + x109: Color; + x110: Color; + x111: Color; + x112: Color; + x113: Color; + x114: Color; + x115: Color; + x116: Color; + x117: Color; + x118: Color; + x119: Color; + x120: Color; + x121: Color; + x122: Color; + x123: Color; + x124: Color; + x125: Color; + x126: Color; + x127: Color; + x128: Color; + x129: Color; + x130: Color; + x131: Color; + x132: Color; + x133: Color; + x134: Color; + x135: Color; + x136: Color; + x137: Color; + x138: Color; + x139: Color; + x140: Color; + x141: Color; + x142: Color; + x143: Color; + x144: Color; + x145: Color; + x146: Color; + x147: Color; + x148: Color; + x149: Color; + x150: Color; + x151: Color; + x152: Color; + x153: Color; + x154: Color; + x155: Color; + x156: Color; + x157: Color; + x158: Color; + x159: Color; + x160: Color; + x161: Color; + x162: Color; + x163: Color; + x164: Color; + x165: Color; + x166: Color; + x167: Color; + x168: Color; + x169: Color; + x170: Color; + x171: Color; + x172: Color; + x173: Color; + x174: Color; + x175: Color; + x176: Color; + x177: Color; + x178: Color; + x179: Color; + x180: Color; + x181: Color; + x182: Color; + x183: Color; + x184: Color; + x185: Color; + x186: Color; + x187: Color; + x188: Color; + x189: Color; + x190: Color; + x191: Color; + x192: Color; + x193: Color; + x194: Color; + x195: Color; + x196: Color; + x197: Color; + x198: Color; + x199: Color; + x200: Color; + x201: Color; + x202: Color; + x203: Color; + x204: Color; + x205: Color; + x206: Color; + x207: Color; + x208: Color; + x209: Color; + x210: Color; + x211: Color; + x212: Color; + x213: Color; + x214: Color; + x215: Color; + x216: Color; + x217: Color; + x218: Color; + x219: Color; + x220: Color; + x221: Color; + x222: Color; + x223: Color; + x224: Color; + x225: Color; + x226: Color; + x227: Color; + x228: Color; + x229: Color; + x230: Color; + x231: Color; + x232: Color; + x233: Color; + x234: Color; + x235: Color; + x236: Color; + x237: Color; + x238: Color; + x239: Color; + x240: Color; + x241: Color; + x242: Color; + x243: Color; + x244: Color; + x245: Color; + x246: Color; + x247: Color; + x248: Color; + x249: Color; + x250: Color; + x251: Color; + x252: Color; + x253: Color; + x254: Color; + x255: Color; +} + +export const black_bbt: Color; +export const red_bbt: Color; +export const green_bbt: Color; +export const yellow_bbt: Color; +export const blue_bbt: Color; +export const magenta_bbt: Color; +export const cyan_bbt: Color; +export const white_bbt: Color; + +export const black_bt: Color; +export const red_bt: Color; +export const green_bt: Color; +export const yellow_bt: Color; +export const blue_bt: Color; +export const magenta_bt: Color; +export const cyan_bt: Color; +export const white_bt: Color; + +export const black_b: Color; +export const red_b: Color; +export const green_b: Color; +export const yellow_b: Color; +export const blue_b: Color; +export const magenta_b: Color; +export const cyan_b: Color; +export const white_b: Color; + +export const black: Color; +export const red: Color; +export const green: Color; +export const yellow: Color; +export const blue: Color; +export const magenta: Color; +export const cyan: Color; +export const white: Color; + +export const bold: Color; +export const faint: Color; +export const italic: Color; +export const underline: Color; +export const blink: Color; +export const overline: Color; +export const inverse: Color; +export const conceal: Color; +export const strike: Color; + +export const x0: Color; +export const x1: Color; +export const x2: Color; +export const x3: Color; +export const x4: Color; +export const x5: Color; +export const x6: Color; +export const x7: Color; +export const x8: Color; +export const x9: Color; +export const x10: Color; +export const x11: Color; +export const x12: Color; +export const x13: Color; +export const x14: Color; +export const x15: Color; +export const x16: Color; +export const x17: Color; +export const x18: Color; +export const x19: Color; +export const x20: Color; +export const x21: Color; +export const x22: Color; +export const x23: Color; +export const x24: Color; +export const x25: Color; +export const x26: Color; +export const x27: Color; +export const x28: Color; +export const x29: Color; +export const x30: Color; +export const x31: Color; +export const x32: Color; +export const x33: Color; +export const x34: Color; +export const x35: Color; +export const x36: Color; +export const x37: Color; +export const x38: Color; +export const x39: Color; +export const x40: Color; +export const x41: Color; +export const x42: Color; +export const x43: Color; +export const x44: Color; +export const x45: Color; +export const x46: Color; +export const x47: Color; +export const x48: Color; +export const x49: Color; +export const x50: Color; +export const x51: Color; +export const x52: Color; +export const x53: Color; +export const x54: Color; +export const x55: Color; +export const x56: Color; +export const x57: Color; +export const x58: Color; +export const x59: Color; +export const x60: Color; +export const x61: Color; +export const x62: Color; +export const x63: Color; +export const x64: Color; +export const x65: Color; +export const x66: Color; +export const x67: Color; +export const x68: Color; +export const x69: Color; +export const x70: Color; +export const x71: Color; +export const x72: Color; +export const x73: Color; +export const x74: Color; +export const x75: Color; +export const x76: Color; +export const x77: Color; +export const x78: Color; +export const x79: Color; +export const x80: Color; +export const x81: Color; +export const x82: Color; +export const x83: Color; +export const x84: Color; +export const x85: Color; +export const x86: Color; +export const x87: Color; +export const x88: Color; +export const x89: Color; +export const x90: Color; +export const x91: Color; +export const x92: Color; +export const x93: Color; +export const x94: Color; +export const x95: Color; +export const x96: Color; +export const x97: Color; +export const x98: Color; +export const x99: Color; +export const x100: Color; +export const x101: Color; +export const x102: Color; +export const x103: Color; +export const x104: Color; +export const x105: Color; +export const x106: Color; +export const x107: Color; +export const x108: Color; +export const x109: Color; +export const x110: Color; +export const x111: Color; +export const x112: Color; +export const x113: Color; +export const x114: Color; +export const x115: Color; +export const x116: Color; +export const x117: Color; +export const x118: Color; +export const x119: Color; +export const x120: Color; +export const x121: Color; +export const x122: Color; +export const x123: Color; +export const x124: Color; +export const x125: Color; +export const x126: Color; +export const x127: Color; +export const x128: Color; +export const x129: Color; +export const x130: Color; +export const x131: Color; +export const x132: Color; +export const x133: Color; +export const x134: Color; +export const x135: Color; +export const x136: Color; +export const x137: Color; +export const x138: Color; +export const x139: Color; +export const x140: Color; +export const x141: Color; +export const x142: Color; +export const x143: Color; +export const x144: Color; +export const x145: Color; +export const x146: Color; +export const x147: Color; +export const x148: Color; +export const x149: Color; +export const x150: Color; +export const x151: Color; +export const x152: Color; +export const x153: Color; +export const x154: Color; +export const x155: Color; +export const x156: Color; +export const x157: Color; +export const x158: Color; +export const x159: Color; +export const x160: Color; +export const x161: Color; +export const x162: Color; +export const x163: Color; +export const x164: Color; +export const x165: Color; +export const x166: Color; +export const x167: Color; +export const x168: Color; +export const x169: Color; +export const x170: Color; +export const x171: Color; +export const x172: Color; +export const x173: Color; +export const x174: Color; +export const x175: Color; +export const x176: Color; +export const x177: Color; +export const x178: Color; +export const x179: Color; +export const x180: Color; +export const x181: Color; +export const x182: Color; +export const x183: Color; +export const x184: Color; +export const x185: Color; +export const x186: Color; +export const x187: Color; +export const x188: Color; +export const x189: Color; +export const x190: Color; +export const x191: Color; +export const x192: Color; +export const x193: Color; +export const x194: Color; +export const x195: Color; +export const x196: Color; +export const x197: Color; +export const x198: Color; +export const x199: Color; +export const x200: Color; +export const x201: Color; +export const x202: Color; +export const x203: Color; +export const x204: Color; +export const x205: Color; +export const x206: Color; +export const x207: Color; +export const x208: Color; +export const x209: Color; +export const x210: Color; +export const x211: Color; +export const x212: Color; +export const x213: Color; +export const x214: Color; +export const x215: Color; +export const x216: Color; +export const x217: Color; +export const x218: Color; +export const x219: Color; +export const x220: Color; +export const x221: Color; +export const x222: Color; +export const x223: Color; +export const x224: Color; +export const x225: Color; +export const x226: Color; +export const x227: Color; +export const x228: Color; +export const x229: Color; +export const x230: Color; +export const x231: Color; +export const x232: Color; +export const x233: Color; +export const x234: Color; +export const x235: Color; +export const x236: Color; +export const x237: Color; +export const x238: Color; +export const x239: Color; +export const x240: Color; +export const x241: Color; +export const x242: Color; +export const x243: Color; +export const x244: Color; +export const x245: Color; +export const x246: Color; +export const x247: Color; +export const x248: Color; +export const x249: Color; +export const x250: Color; +export const x251: Color; +export const x252: Color; +export const x253: Color; +export const x254: Color; +export const x255: Color; diff --git a/JS/node_modules/colors-cli/lib/color.js b/JS/node_modules/colors-cli/lib/color.js new file mode 100644 index 00000000..a8ce3260 --- /dev/null +++ b/JS/node_modules/colors-cli/lib/color.js @@ -0,0 +1,212 @@ +/** + * + * [The opaque named colors](https://drafts.csswg.org/css-color/#named-colors) + * [ANSI Escape sequences](http://ascii-table.com/ansi-escape-sequences.php) + * [ANSI escape code](https://en.wikipedia.org/wiki/ANSI_escape_code) + * [Linux Shell Scripting Tutorial](http://www.freeos.com/guides/lsst/misc.htm#colorfunandmore) + * + * [tip colors and formatting](http://misc.flogisoft.com/bash/tip_colors_and_formatting) + * + */ + +var _styles = require('./styles-name') +var isSupported = require('./supports-colors') +var colors = _styles.colors; +var styles = _styles.styles; + +exports.color = {} + +function Colors(str){ + this.string = str; + this.styles = []; + this.fgcolor = null; // Foreground + this.bgcolor = null; // Background + this.fgcolor_bt = null; // Bright Foreground + this.bgcolor_bt = null; // Bright Background + this.fgcolor_x = null; // 256 Foreground + this.bgcolor_x = null; // 256 Background +} + +// 字背景颜色范围:40~49 +// 40:黑, 41:深红, 42:绿, 43:黄色, 44:蓝色, 45:紫色, 46:深绿, 47:白色, +// 字颜色:30~39 +// 30:黑, 31:红, 32:绿, 33:黄, 34:蓝色, 35:紫色, 36:深绿, 37:白色, +// +// echo -e "\x1b[31;1m color red underline \x1b[0m" +// 1m 亮的颜色,默认不给是暗淡的颜色 +// +// | ANSI | ANSI | ANSI | | Aixterm | Aixterm +// | Color | FG Code | BG Code | Bright Color | FG Code | BG Code +// +---------+---------+-------- +----------------+---------+-------- +// | Black | 30 | 40 | Bright Black | 90 | 100 +// | Red | 31 | 41 | Bright Red | 91 | 101 +// | Green | 32 | 42 | Bright Green | 92 | 102 +// | Yellow | 33 | 43 | Bright Yellow | 93 | 103 +// | Blue | 34 | 44 | Bright Blue | 94 | 104 +// | Magenta | 35 | 45 | Bright Magenta | 95 | 105 +// | Cyan | 36 | 46 | Bright Cyan | 96 | 106 +// | White | 37 | 47 | Bright White | 97 | 107 +// + +for (var i = 0; i < colors.length; i++) { + (function(i){ + var name = colors[i]; + Object.defineProperty(Colors.prototype, name, { + get: function() { + // Foreground 前景色 + this.fgcolor = i; + return this; + } + }); + Object.defineProperty(Colors.prototype, name + '_b', { + get: function () { + // Background 背景色 + this.bgcolor = i; + return this; + } + }); + Object.defineProperty(Colors.prototype, name + '_bt', { + get: function () { + // Bright Foreground 明亮 前景色 + this.fgcolor_bt = i; + return this; + } + }); + Object.defineProperty(Colors.prototype, name + '_bbt', { + get: function () { + // Bright Background 明亮 背景色 + this.bgcolor_bt = i; + return this; + } + }); + + exports.color[name] = exports[name] = function(text) { + if (!isSupported) return text; + return '\x1b[' + (30 + i) + 'm' + text + '\x1b[0m'; + }; + exports.color[name + '_b'] = exports[name + '_b'] = function(text) { + if (!isSupported) return text; + return '\x1b[' + (40 + i) + 'm' + text + '\x1b[0m'; + }; + + exports.color[name + '_bt'] = exports[name + '_bt'] = function(text) { + if (!isSupported) return text; + return '\x1b[' + (90 + i) + 'm' + text + '\x1b[0m'; + }; + exports.color[name + '_bbt'] = exports[name + '_bbt'] = function(text) { + if (!isSupported) return text; + return '\x1b[' + (100 + i) + 'm' + text + '\x1b[0m'; + }; + })(i) +} + + +for (var i = 0; i < 256; i++) { + (function(i){ + Object.defineProperty(Colors.prototype, 'x'+i, { + get: function() { + this.fgcolor_x = i; + return this; + } + }); + Object.defineProperty(Colors.prototype, 'xb'+i, { + get: function() { + this.bgcolor_x = i; + return this; + } + }); + + exports.color['x'+i] = exports['x'+i] = function(text) { + if (!isSupported) return text; + return '\x1b[38;5;' + i + 'm' + text + '\x1b[0m'; + }; + + exports.color['xb'+i] = exports['xb'+i] = function(text) { + if (!isSupported) return text; + return '\x1b[48;5;' + i + 'm' + text + '\x1b[0m'; + }; + })(i) +} +/** + * ANSI控制码的说明 + * + * 33[0m 关闭所有属性 + * 33[1m 设置高亮度 + * 33[4m 下划线 + * 33[5m 闪烁 + * 33[7m 反显 + * 33[8m 消隐 + * 33[30m -- 33[37m 设置前景色 + * 33[40m -- 33[47m 设置背景色 + * 33[nA 光标上移n行 + * 33[nB 光标下移n行 + * 33[nC 光标右移n行 + * 33[nD 光标左移n行 + * 33[y;xH设置光标位置 + * 33[2J 清屏 + * 33[K 清除从光标到行尾的内容 + * 33[s 保存光标位置 + * 33[u 恢复光标位置 + * 33[?25l 隐藏光标 + * 33[?25h 显示光标 + */ + +for (var i = 0; i < styles.length; i++) { + (function(i) { + var name = styles[i]; + Object.defineProperty(Colors.prototype, name, { + get: function() { + if (this.styles.indexOf(i) === -1) { + this.styles = this.styles.concat(i + 1); + } + return this; + } + }); + exports.color[name] = exports[name] = function(text) { + if (!isSupported) return text; + return '\x1b[' + (i + 1) + 'm' + text + '\x1b[0m'; + }; + })(i); +} + +Colors.prototype.colored = function (text) { + var reset = '\x1b[0m'; + var is256 = isSupported; + // 256 Foreground 256 前景色 + if (this.fgcolor_x && this.fgcolor_x !== null && is256) { + text = '\x1b[38;5;' + this.fgcolor_x + 'm' + text + reset; + } + // 256 Foreground 256 前景色 + if (this.bgcolor_x && this.bgcolor_x !== null && is256) { + text = '\x1b[48;5;' + this.bgcolor_x + 'm' + text + reset; + } + // Foreground 前景色 + if (this.fgcolor !== null && this.fgcolor < 8) { + text = '\x1b[' + (30 + this.fgcolor) + 'm' + text + reset; + } + // Bright Foreground 亮 前景色 + if (this.fgcolor_bt !== null && this.fgcolor_bt < 8) { + text = '\x1b[' + (90 + this.fgcolor_bt) + 'm' + text + reset; + } + // Background 背景色 + if (this.bgcolor !== null && this.bgcolor < 8) { + text = '\x1b[' + (40 + this.bgcolor) + 'm' + text + reset; + } + // Bright Background 亮 背景色 + if (this.bgcolor_bt !== null && this.bgcolor_bt < 8) { + text = '\x1b[' + (100 + this.bgcolor_bt) + 'm' + text + reset; + } + + if (this.styles && this.styles.length) { + text = '\x1b[' + this.styles.join(';') + 'm' + text + reset; + } + return text; +} + +Colors.prototype.valueOf = function(type){ + var text = this.string; + text = this.colored(text); + return text; +} + +exports.Colors = Colors; diff --git a/JS/node_modules/colors-cli/lib/index.js b/JS/node_modules/colors-cli/lib/index.js new file mode 100644 index 00000000..76964498 --- /dev/null +++ b/JS/node_modules/colors-cli/lib/index.js @@ -0,0 +1,3 @@ +const color = require('./color'); + +exports = module.exports = color; diff --git a/JS/node_modules/colors-cli/lib/styles-name.js b/JS/node_modules/colors-cli/lib/styles-name.js new file mode 100644 index 00000000..cd098c62 --- /dev/null +++ b/JS/node_modules/colors-cli/lib/styles-name.js @@ -0,0 +1,43 @@ +module.exports = { + // 字背景颜色范围:40~49 + // 40:黑, 41:深红, 42:绿, 43:黄色, 44:蓝色, 45:紫色, 46:深绿, 47:白色, + // 字颜色:30~39 + // 30:黑, 31:红, 32:绿, 33:黄, 34:蓝色, 35:紫色, 36:深绿, 37:白色, + // + // echo -e "\x1b[31;1m color red underline \x1b[0m" + // 1m 亮的颜色,默认不给是暗淡的颜色 + // + // | ANSI | ANSI | ANSI | | Aixterm | Aixterm + // | Color | FG Code | BG Code | Bright Color | FG Code | BG Code + // +---------+---------+-------- +----------------+---------+-------- + // | Black | 30 | 40 | Bright Black | 90 | 100 + // | Red | 31 | 41 | Bright Red | 91 | 101 + // | Green | 32 | 42 | Bright Green | 92 | 102 + // | Yellow | 33 | 43 | Bright Yellow | 93 | 103 + // | Blue | 34 | 44 | Bright Blue | 94 | 104 + // | Magenta | 35 | 45 | Bright Magenta | 95 | 105 + // | Cyan | 36 | 46 | Bright Cyan | 96 | 106 + // | White | 37 | 47 | Bright White | 97 | 107 + // + colors: [ + 'black', + 'red', + 'green', + 'yellow', + 'blue', + 'magenta', + 'cyan', + 'white' + ], + styles:[ + 'bold', //粗体 + 'faint', + 'italic', + 'underline', + 'blink', + 'overline', + 'inverse', + 'conceal', + 'strike' + ] +} diff --git a/JS/node_modules/colors-cli/lib/supports-colors.js b/JS/node_modules/colors-cli/lib/supports-colors.js new file mode 100644 index 00000000..ebe2da55 --- /dev/null +++ b/JS/node_modules/colors-cli/lib/supports-colors.js @@ -0,0 +1,36 @@ +var argv = process.argv; + +module.exports = (function () { + if (argv.indexOf('--no-color') !== -1 || + argv.indexOf('--color=false') !== -1) { + return false; + } + + if (argv.indexOf('--color') !== -1 || + argv.indexOf('--color=true') !== -1 || + argv.indexOf('--color=always') !== -1) { + return true; + } + + if (process.stdout && !process.stdout.isTTY) { + return false; + } + + if (process.platform === 'win32') { + return true; + } + + if ('COLORTERM' in process.env) { + return true; + } + + if (process.env.TERM === 'dumb') { + return false; + } + + if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) { + return true; + } + + return false; +})(); diff --git a/JS/node_modules/colors-cli/package.json b/JS/node_modules/colors-cli/package.json new file mode 100644 index 00000000..dc2eaeeb --- /dev/null +++ b/JS/node_modules/colors-cli/package.json @@ -0,0 +1,66 @@ +{ + "name": "colors-cli", + "version": "1.0.32", + "description": "Terminal string styling done right", + "homepage": "https://jaywcjlove.github.io/colors-cli/", + "main": "lib/index.js", + "exports": { + ".": "./lib/index.js", + "./index": "./lib/index.js", + "./color": "./lib/color.js", + "./lib/color.js": "./lib/color.js", + "./color-name": "./lib/color-name.js", + "./color-name.js": "./lib/color-name.js", + "./lib/color-name.js.js": "./lib/color-name.js", + "./color-safe": "./lib/color-safe.js", + "./color-safe.js": "./lib/color-safe.js", + "./lib/color-safe.js.js": "./lib/color-safe.js", + "./styles-name": "./lib/styles-name.js", + "./styles-name.js": "./lib/styles-name.js", + "./lib/styles-name.js.js": "./lib/styles-name.js", + "./safe": "./safe.js", + "./safe.js": "./safe.js", + "./toxic.js": "./toxic.js", + "./toxic": "./toxic.js" + }, + "directories": { + "test": "test" + }, + "bin": { + "colors": "./bin/colors" + }, + "repository": { + "type": "git", + "url": "https://github.com/jaywcjlove/colors-cli.git" + }, + "scripts": { + "test": "node ./test/safe.test.js & node ./test/group.test.js && node ./test/toxic.test.js && node ./test/256.test.js" + }, + "keywords": [ + "256color", + "color", + "colors", + "colors-cli", + "terminal", + "ansi", + "console", + "colour", + "cli", + "string", + "str", + "style", + "styles", + "tty", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "author": "kenny wang ", + "license": "MIT" +} diff --git a/JS/node_modules/colors-cli/renovate.json b/JS/node_modules/colors-cli/renovate.json new file mode 100644 index 00000000..f45d8f11 --- /dev/null +++ b/JS/node_modules/colors-cli/renovate.json @@ -0,0 +1,5 @@ +{ + "extends": [ + "config:base" + ] +} diff --git a/JS/node_modules/colors-cli/safe.d.ts b/JS/node_modules/colors-cli/safe.d.ts new file mode 100644 index 00000000..e8735434 --- /dev/null +++ b/JS/node_modules/colors-cli/safe.d.ts @@ -0,0 +1,304 @@ +import { Color } from './lib/color'; + +export const black_bbt: Color; +export const red_bbt: Color; +export const green_bbt: Color; +export const yellow_bbt: Color; +export const blue_bbt: Color; +export const magenta_bbt: Color; +export const cyan_bbt: Color; +export const white_bbt: Color; + +export const black_bt: Color; +export const red_bt: Color; +export const green_bt: Color; +export const yellow_bt: Color; +export const blue_bt: Color; +export const magenta_bt: Color; +export const cyan_bt: Color; +export const white_bt: Color; + +export const black_b: Color; +export const red_b: Color; +export const green_b: Color; +export const yellow_b: Color; +export const blue_b: Color; +export const magenta_b: Color; +export const cyan_b: Color; +export const white_b: Color; + +export const black: Color; +export const red: Color; +export const green: Color; +export const yellow: Color; +export const blue: Color; +export const magenta: Color; +export const cyan: Color; +export const white: Color; + +export const bold: Color; +export const faint: Color; +export const italic: Color; +export const underline: Color; +export const blink: Color; +export const overline: Color; +export const inverse: Color; +export const conceal: Color; +export const strike: Color; + +export const x0: Color; +export const x1: Color; +export const x2: Color; +export const x3: Color; +export const x4: Color; +export const x5: Color; +export const x6: Color; +export const x7: Color; +export const x8: Color; +export const x9: Color; +export const x10: Color; +export const x11: Color; +export const x12: Color; +export const x13: Color; +export const x14: Color; +export const x15: Color; +export const x16: Color; +export const x17: Color; +export const x18: Color; +export const x19: Color; +export const x20: Color; +export const x21: Color; +export const x22: Color; +export const x23: Color; +export const x24: Color; +export const x25: Color; +export const x26: Color; +export const x27: Color; +export const x28: Color; +export const x29: Color; +export const x30: Color; +export const x31: Color; +export const x32: Color; +export const x33: Color; +export const x34: Color; +export const x35: Color; +export const x36: Color; +export const x37: Color; +export const x38: Color; +export const x39: Color; +export const x40: Color; +export const x41: Color; +export const x42: Color; +export const x43: Color; +export const x44: Color; +export const x45: Color; +export const x46: Color; +export const x47: Color; +export const x48: Color; +export const x49: Color; +export const x50: Color; +export const x51: Color; +export const x52: Color; +export const x53: Color; +export const x54: Color; +export const x55: Color; +export const x56: Color; +export const x57: Color; +export const x58: Color; +export const x59: Color; +export const x60: Color; +export const x61: Color; +export const x62: Color; +export const x63: Color; +export const x64: Color; +export const x65: Color; +export const x66: Color; +export const x67: Color; +export const x68: Color; +export const x69: Color; +export const x70: Color; +export const x71: Color; +export const x72: Color; +export const x73: Color; +export const x74: Color; +export const x75: Color; +export const x76: Color; +export const x77: Color; +export const x78: Color; +export const x79: Color; +export const x80: Color; +export const x81: Color; +export const x82: Color; +export const x83: Color; +export const x84: Color; +export const x85: Color; +export const x86: Color; +export const x87: Color; +export const x88: Color; +export const x89: Color; +export const x90: Color; +export const x91: Color; +export const x92: Color; +export const x93: Color; +export const x94: Color; +export const x95: Color; +export const x96: Color; +export const x97: Color; +export const x98: Color; +export const x99: Color; +export const x100: Color; +export const x101: Color; +export const x102: Color; +export const x103: Color; +export const x104: Color; +export const x105: Color; +export const x106: Color; +export const x107: Color; +export const x108: Color; +export const x109: Color; +export const x110: Color; +export const x111: Color; +export const x112: Color; +export const x113: Color; +export const x114: Color; +export const x115: Color; +export const x116: Color; +export const x117: Color; +export const x118: Color; +export const x119: Color; +export const x120: Color; +export const x121: Color; +export const x122: Color; +export const x123: Color; +export const x124: Color; +export const x125: Color; +export const x126: Color; +export const x127: Color; +export const x128: Color; +export const x129: Color; +export const x130: Color; +export const x131: Color; +export const x132: Color; +export const x133: Color; +export const x134: Color; +export const x135: Color; +export const x136: Color; +export const x137: Color; +export const x138: Color; +export const x139: Color; +export const x140: Color; +export const x141: Color; +export const x142: Color; +export const x143: Color; +export const x144: Color; +export const x145: Color; +export const x146: Color; +export const x147: Color; +export const x148: Color; +export const x149: Color; +export const x150: Color; +export const x151: Color; +export const x152: Color; +export const x153: Color; +export const x154: Color; +export const x155: Color; +export const x156: Color; +export const x157: Color; +export const x158: Color; +export const x159: Color; +export const x160: Color; +export const x161: Color; +export const x162: Color; +export const x163: Color; +export const x164: Color; +export const x165: Color; +export const x166: Color; +export const x167: Color; +export const x168: Color; +export const x169: Color; +export const x170: Color; +export const x171: Color; +export const x172: Color; +export const x173: Color; +export const x174: Color; +export const x175: Color; +export const x176: Color; +export const x177: Color; +export const x178: Color; +export const x179: Color; +export const x180: Color; +export const x181: Color; +export const x182: Color; +export const x183: Color; +export const x184: Color; +export const x185: Color; +export const x186: Color; +export const x187: Color; +export const x188: Color; +export const x189: Color; +export const x190: Color; +export const x191: Color; +export const x192: Color; +export const x193: Color; +export const x194: Color; +export const x195: Color; +export const x196: Color; +export const x197: Color; +export const x198: Color; +export const x199: Color; +export const x200: Color; +export const x201: Color; +export const x202: Color; +export const x203: Color; +export const x204: Color; +export const x205: Color; +export const x206: Color; +export const x207: Color; +export const x208: Color; +export const x209: Color; +export const x210: Color; +export const x211: Color; +export const x212: Color; +export const x213: Color; +export const x214: Color; +export const x215: Color; +export const x216: Color; +export const x217: Color; +export const x218: Color; +export const x219: Color; +export const x220: Color; +export const x221: Color; +export const x222: Color; +export const x223: Color; +export const x224: Color; +export const x225: Color; +export const x226: Color; +export const x227: Color; +export const x228: Color; +export const x229: Color; +export const x230: Color; +export const x231: Color; +export const x232: Color; +export const x233: Color; +export const x234: Color; +export const x235: Color; +export const x236: Color; +export const x237: Color; +export const x238: Color; +export const x239: Color; +export const x240: Color; +export const x241: Color; +export const x242: Color; +export const x243: Color; +export const x244: Color; +export const x245: Color; +export const x246: Color; +export const x247: Color; +export const x248: Color; +export const x249: Color; +export const x250: Color; +export const x251: Color; +export const x252: Color; +export const x253: Color; +export const x254: Color; +export const x255: Color; diff --git a/JS/node_modules/colors-cli/safe.js b/JS/node_modules/colors-cli/safe.js new file mode 100644 index 00000000..8665a1ca --- /dev/null +++ b/JS/node_modules/colors-cli/safe.js @@ -0,0 +1,2 @@ +var colors = require('./lib/color-safe'); +module.exports = colors; \ No newline at end of file diff --git a/JS/node_modules/colors-cli/toxic.d.ts b/JS/node_modules/colors-cli/toxic.d.ts new file mode 100644 index 00000000..8011747d --- /dev/null +++ b/JS/node_modules/colors-cli/toxic.d.ts @@ -0,0 +1,5 @@ +import { Color } from './lib/color'; + +declare global { + interface String extends Color {} +} diff --git a/JS/node_modules/colors-cli/toxic.js b/JS/node_modules/colors-cli/toxic.js new file mode 100644 index 00000000..a543291b --- /dev/null +++ b/JS/node_modules/colors-cli/toxic.js @@ -0,0 +1,19 @@ +const co = require('./lib/color'); + +exports = module.exports = co; + +function toxic() { + // 在String原型上扩展 + // 不建议在原型对象上扩展 + var colors = exports.color; + Object.keys(colors).forEach(function (key) { + var fn = colors[key]; + Object.defineProperty(String.prototype, key, { + get: function () { + return fn(this.valueOf()); + } + }); + }); +}; + +module.exports = toxic(); \ No newline at end of file diff --git a/JS/node_modules/loading-cli/README.md b/JS/node_modules/loading-cli/README.md new file mode 100644 index 00000000..a44b1cdb --- /dev/null +++ b/JS/node_modules/loading-cli/README.md @@ -0,0 +1,138 @@ +# loading-cli + +[![](https://jaywcjlove.github.io/sb/ico/npm.svg)](https://www.npmjs.com/package/loading-cli) [![Build Status](https://travis-ci.org/jaywcjlove/loading-cli.svg?branch=master)](https://travis-ci.org/jaywcjlove/loading-cli) + +Terminal loading effect. + + + +# Install + +```bash +$ npm install --save loading-cli +``` + +# Usage + +```js +const loading = require('loading-cli'); +const load = loading("loading text!!").start() + +setTimeout(function(){ + load.color = 'yellow'; + load.text = ' Loading rainbows'; +},2000) + +// stop +setTimeout(function(){ + load.stop() +},3000) +``` + +Custom text color [colors-cli](https://github.com/jaywcjlove/colors-cli) + +```js +const color = require('colors-cli/toxic'); +const loading = require('loading-cli'); + +const load = loading("loading text!!".blue).start(); +// stop +setTimeout(function(){ + load.stop() +},3000) +``` + +# API + +## loading([options|text]) + +### options + +```js +load({ + "text":"loading text!!", + "color":"yellow", + "interval":100, + "stream": process.stdout, + "frames":["◰", "◳", "◲", "◱"] +}) +``` + +### text + +Type: string +Text to display after the spinner. + +```js +loading("loading text!!") +``` + +## color + +Values:`black` `red` `green` `yellow` `blue` `magenta` `cyan` `white` `gray` + + +## frames + +```bash +["◰", "◳", "◲", "◱"] +["◐", "◓", "◑", "◒"] +[".", "o", "O", "°", "O", "o", "."] +["⊶", "⊷"] +["ဝ", "၀"] +["←", "↖", "↑", "↗", "→", "↘", "↓", "↙"] +["🕐 ", "🕑 ", "🕒 ", "🕓 ", "🕔 ", "🕕 ", "🕖 ", "🕗 ", "🕘 ", "🕙 ", "🕚 "] +``` + +# Instance + +## .start([text]) + +Start the spinner. Returns the instance. + +## .stop() + +Stop and clear the spinner. Returns the instance. + +## .clear() + +Clear the spinner. Returns the instance. + +## .succeed([text]) + +Stop the spinner, change it to a green `✔` and persist the current text, or text if provided. Returns the instance. See the GIF below. + +## .fail([text]) + +Stop the spinner, change it to a red `✖` and persist the current text, or text if provided. Returns the instance. See the GIF below. + +## .warn([text]) + +Stop the spinner, change it to a yellow `⚠` and persist the current text, or text if provided. Returns the instance. + +## .info([text]) + +Stop the spinner, change it to a blue `ℹ` and persist the current text, or text if provided. Returns the instance. + +## .render() + +Manually render a new frame. Returns the instance. + +## .frame() + +Get a new frame. + +```js +const loading = require('loading-cli'); +const load = loading("loading text!!"); +load.frame(["◰", "◳", "◲", "◱"]); +load.start(); +``` + +## .text + +Change the text. + +## .color + +Change the spinner color. diff --git a/JS/node_modules/loading-cli/index.d.ts b/JS/node_modules/loading-cli/index.d.ts new file mode 100644 index 00000000..d9b61fd3 --- /dev/null +++ b/JS/node_modules/loading-cli/index.d.ts @@ -0,0 +1,80 @@ +/// + +declare namespace loading { + interface Options { + text?: string; + color?: string; + interval?: number; + stream?: NodeJS.WritableStream; + frames?: string[]; + } + interface Loading { + /** + * Change the text after the spinner. + */ + text: string; + /** + * Change the spinner color. + */ + color: string; + /** + * Start the spinner. + * @param text - Set the current text. + */ + start(text?: string): Loading; + /** + * Stop and clear the spinner. + * @returns The spinner instance. + */ + stop(): Loading; + /** + * Clear the spinner. + * @returns The spinner instance. + */ + clear(): Loading; + /** + * Stop the spinner, change it to a green `✔` and persist the current text, or `text` if provided. + * @param text - Will persist text if provided. + * @returns The spinner instance. + */ + succeed(text?: string): Loading; + + /** + * Stop the spinner, change it to a red `✖` and persist the current text, or `text` if provided. + * @param text - Will persist text if provided. + * @returns The spinner instance. + */ + fail(text?: string): Loading; + /** + * Stop the spinner, change it to a yellow `⚠` and persist the current text, or `text` if provided. + * @param text - Will persist text if provided. + * @returns The spinner instance. + */ + warn(text?: string): Loading; + + /** + * Stop the spinner, change it to a blue `ℹ` and persist the current text, or `text` if provided. + * @param text - Will persist text if provided. + * @returns The spinner instance. + */ + info(text?: string): Loading; + + /** + * Manually render a new frame. + * @returns The spinner instance. + */ + render(): Loading; + /** + * Get a new frame. + * @returns The spinner instance text. + */ + frame(): string; + } +} + +declare const loading: { + (options?: loading.Options | string): loading.Loading; +} + + +export = loading; diff --git a/JS/node_modules/loading-cli/lib/cursor.js b/JS/node_modules/loading-cli/lib/cursor.js new file mode 100644 index 00000000..27f6bc4f --- /dev/null +++ b/JS/node_modules/loading-cli/lib/cursor.js @@ -0,0 +1,50 @@ +/** + * ANSI控制码的说明 + * + * 33[0m 关闭所有属性 + * 33[1m 设置高亮度 + * 33[4m 下划线 + * 33[5m 闪烁 + * 33[7m 反显 + * 33[8m 消隐 + * 33[30m -- 33[37m 设置前景色 + * 33[40m -- 33[47m 设置背景色 + * 33[nA 光标上移n行 + * 33[nB 光标下移n行 + * 33[nC 光标右移n行 + * 33[nD 光标左移n行 + * 33[y;xH设置光标位置 + * 33[2J 清屏 + * 33[K 清除从光标到行尾的内容 + * 33[s 保存光标位置 + * 33[u 恢复光标位置 + * 33[?25l 隐藏光标 + * 33[?25h 显示光标 + */ +var hidden = false; +exports.show = function (stream) { + const s = stream || process.stderr; + if (!s.isTTY) { + return; + } + hidden = false; + s.write('\u001b[?25h'); +}; +exports.hide = function (stream) { + var s = stream || process.stderr; + if (!s.isTTY) { + return; + } + hidden = true; + s.write('\u001b[?25l'); +}; +exports.toggle = function (force) { + if (force !== undefined) { + hidden = force; + } + if (hidden) { + exports.show(); + } else { + exports.hide(); + } +}; diff --git a/JS/node_modules/loading-cli/lib/index.js b/JS/node_modules/loading-cli/lib/index.js new file mode 100644 index 00000000..6b932971 --- /dev/null +++ b/JS/node_modules/loading-cli/lib/index.js @@ -0,0 +1,117 @@ +var ut = require('./utilities'); +var cursor = require('./cursor'); +var color = require('colors-cli') + +function loading(options) { + if (!(this instanceof loading)) { + return new loading(options) + } + if (typeof options === 'string') { + options = { + text: options + } + } + + this.options = ut.extend(options, { + text: '', + color: 'cyan', + stream: process.stderr, + // stream: process.stdout + // loading 样式 + frames: ["◜", "◠", "◝", "◞", "◡", "◟"] + }); + + // 文本显示 + this.text = this.options.text; + + // 颜色显示 + this.color = this.options.color; + + // 动画间隔时间 + this.interval = this.options.interval || 60; + this.stream = this.options.stream; + + // loading 样式 + this.frames = this.options.frames; + + // 不存在 + this.id = null; + + // 要检查 Node 是否正在运行一个 TTY上下文 中 + // linux 中没有运行在 tty 下的进程是 守护进程 + this.enabled = this.options.enabled || ((this.stream && this.stream.isTTY) && !process.env.CI); + this.frameIndex = 0; +} + +loading.prototype.frame = function (frame) { + if (frame) this.options.frames = frame; + var frames = this.options.frames; + // var frames = ["◜", "◠", "◝", "◞", "◡", "◟"]; + // var frames = ["◰", "◳", "◲", "◱"] + // var frames = ["◐", "◓", "◑", "◒"] + // var frames = [".", "o", "O", "°", "O", "o", "."] + // var frames = ["⊶", "⊷"] + // var frames = ["ဝ", "၀"] + // var frames = ["←", "↖", "↑", "↗", "→", "↘", "↓", "↙"] + // var frames = ["🕐 ", "🕑 ", "🕒 ", "🕓 ", "🕔 ", "🕕 ", "🕖 ", "🕗 ", "🕘 ", "🕙 ", "🕚 "] + var frame = frames[this.frameIndex]; + if (this.color) { + frame = color[this.color](frame); + } + this.frameIndex = ++this.frameIndex % frames.length; + return frame + ' ' + this.text; +} + +loading.prototype.clear = function () { + if (!this.enabled) { + return this; + } + this.stream.clearLine(); + this.stream.cursorTo(0); + return this; +} + +loading.prototype.render = function () { + this.clear(); + this.stream.write(this.frame()); + return this; +} + +loading.prototype.start = function (text) { + if (text) this.text = text; + if (!this.enabled || this.id) return this; + this.clear(); + cursor.hide(this.stream); + this.id = setInterval(this.render.bind(this), this.interval); + return this; +} + +loading.prototype.stop = function () { + if (!this.enabled) return this; + clearInterval(this.id); + this.id = null; + this.clear(); + cursor.show(this.stream); + return this; +} + +loading.prototype.succeed = function (text) { + return this.stopAndPersist(color.green('✔'), text); +} +loading.prototype.fail = function (text) { + return this.stopAndPersist(color.red('✖'), text); +} +loading.prototype.warn = function (text) { + return this.stopAndPersist(color.yellow('⚠'), text); +} +loading.prototype.info = function (text) { + return this.stopAndPersist(color.blue('ℹ'), text); +} +loading.prototype.stopAndPersist = function (symbol, text) { + text = text || this.text + this.stop(); + this.stream.write((symbol ? symbol + ' ' : ' ') + text + '\n'); + return this; +} + +module.exports = loading diff --git a/JS/node_modules/loading-cli/lib/utilities.js b/JS/node_modules/loading-cli/lib/utilities.js new file mode 100644 index 00000000..22f5aaad --- /dev/null +++ b/JS/node_modules/loading-cli/lib/utilities.js @@ -0,0 +1,17 @@ +module.exports = { + extend:extend +} + +// 合并对象 +function extend(des, src, override){ + if(src instanceof Array){ + for(var i = 0, len = src.length; i < len; i++) + extend(des, src[i], override); + } + for( var i in src){ + if(override || !(i in des)){ + des[i] = src[i]; + } + } + return des; +} diff --git a/JS/node_modules/loading-cli/package.json b/JS/node_modules/loading-cli/package.json new file mode 100644 index 00000000..501ab737 --- /dev/null +++ b/JS/node_modules/loading-cli/package.json @@ -0,0 +1,42 @@ +{ + "name": "loading-cli", + "version": "1.1.0", + "description": "Terminal loading effect.", + "main": "lib/index.js", + "scripts": { + "test": "node test/test.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/jaywcjlove/loading-cli" + }, + "keywords": [ + "command", + "loading-cli", + "loading", + "exit", + "quit", + "process", + "graceful", + "shutdown", + "sigterm", + "sigint", + "cli", + "cursor", + "ansi", + "term", + "terminal", + "console", + "shell", + "command-line" + ], + "files": [ + "lib", + "index.d.ts" + ], + "author": "kenny wang ", + "license": "MIT", + "dependencies": { + "colors-cli": "^1.0.26" + } +} diff --git a/JS/package-lock.json b/JS/package-lock.json index 770e30a1..94211188 100644 --- a/JS/package-lock.json +++ b/JS/package-lock.json @@ -7,7 +7,26 @@ "": { "name": "execercise", "version": "1.0.0", - "license": "ISC" + "license": "ISC", + "dependencies": { + "loading-cli": "^1.1.0" + } + }, + "node_modules/colors-cli": { + "version": "1.0.32", + "resolved": "https://registry.npmjs.org/colors-cli/-/colors-cli-1.0.32.tgz", + "integrity": "sha512-zHMwyBeZ1PEo1sm11JA2SFw5/+5AB0aRBmQZbO8qOZ0bCeDEpoJDe+UZbG/oICiQ9/m6vLBd/3GASAP9GfSkwA==", + "bin": { + "colors": "bin/colors" + } + }, + "node_modules/loading-cli": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/loading-cli/-/loading-cli-1.1.0.tgz", + "integrity": "sha512-r6Kj0Y3d3isT4vvJ0tFlND1CcLkpatWmlgQs/PEfnSofJSHZwAbsqexnpQEDj4nlxSXEqFWh/Wu2iQXAAZRPNQ==", + "dependencies": { + "colors-cli": "^1.0.26" + } } } } diff --git a/JS/package.json b/JS/package.json index cfc1ed91..30c85ccf 100644 --- a/JS/package.json +++ b/JS/package.json @@ -7,5 +7,8 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", - "license": "ISC" + "license": "ISC", + "dependencies": { + "loading-cli": "^1.1.0" + } } diff --git a/JS/test.js b/JS/test.js index cc9f5abf..3c932a4e 100644 --- a/JS/test.js +++ b/JS/test.js @@ -1,26 +1,38 @@ -async function getData() { +const loading = require('loading-cli'); +const load = loading("loading...") - fetch('https://api.github.com/users') - .then ((response)=>{ - return response.json(); - }) - .then((response)=>{ - const res = console.log(response) - if(!Object.keys(res.data).length){ - console.log("no data found"); +const users=[ "jinal-gajjar","nvsnjksngiormhum","nilam-singh","JayPonda","chintansakhiya","Ami-Kalola","aniketgohelimp","Ankit Jilka","Annavar-satish","Bhautik","Bhoomiz01","VatsaL","Rakshit Menpara","dhruvjoshi2000","abcd","Disha-Kothari","JAY PONDA IMPROWISED"]; + +const detail=[]; + +let notFound = 0; +let found = 0; +async function getData(){ + const timeStart=Date.now(); + + for(let user of users){ + userDetail =await fetch(`https://api.github.com/users/${user}`,{ + + }).then(res => res.json()).then(val=>{ + detail.push(val); + if (val.message=="Not Found"){ + notFound++ + } + else{ + found++ } }); } -//console.log(JSON.stringify(response)); -//console.log(response) -// console.log(response.status) -// console.log(response.statusText); + const timeEnd = Date.now(); + load.stop() + const countTime = (timeEnd-timeStart)/1000 + console.log("timing in (ms):"+countTime) + console.log("Total Found:" + found ) + console.log("Not Found:" + notFound) +} -// if (response.status === 200) { -// let data = response.text(); -// } -// .then( -// console.log(response) -// ) -// } -getData(); +function Demo(){ + load.start() + getData() +} +Demo() \ No newline at end of file