mirror of
https://github.com/shimataro/ssh-key-action.git
synced 2025-06-19 22:52:10 +10:00
* first action! (#1)
This commit is contained in:
parent
8deacc95b1
commit
ace1e6a69a
3750 changed files with 1155519 additions and 0 deletions
178
node_modules/boxen/index.d.ts
generated
vendored
Normal file
178
node_modules/boxen/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,178 @@
|
|||
import {LiteralUnion} from 'type-fest';
|
||||
import cliBoxes, {BoxStyle} from 'cli-boxes';
|
||||
|
||||
declare namespace boxen {
|
||||
/**
|
||||
Characters used for custom border.
|
||||
|
||||
@example
|
||||
```
|
||||
// affffb
|
||||
// e e
|
||||
// dffffc
|
||||
|
||||
const border: CustomBorderStyle = {
|
||||
topLeft: 'a',
|
||||
topRight: 'b',
|
||||
bottomRight: 'c',
|
||||
bottomLeft: 'd',
|
||||
vertical: 'e',
|
||||
horizontal: 'f'
|
||||
};
|
||||
```
|
||||
*/
|
||||
interface CustomBorderStyle extends BoxStyle {}
|
||||
|
||||
/**
|
||||
Spacing used for `padding` and `margin`.
|
||||
*/
|
||||
interface Spacing {
|
||||
readonly top: number;
|
||||
readonly right: number;
|
||||
readonly bottom: number;
|
||||
readonly left: number;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
Color of the box border.
|
||||
*/
|
||||
readonly borderColor?: LiteralUnion<
|
||||
| 'black'
|
||||
| 'red'
|
||||
| 'green'
|
||||
| 'yellow'
|
||||
| 'blue'
|
||||
| 'magenta'
|
||||
| 'cyan'
|
||||
| 'white'
|
||||
| 'gray'
|
||||
| 'grey'
|
||||
| 'blackBright'
|
||||
| 'redBright'
|
||||
| 'greenBright'
|
||||
| 'yellowBright'
|
||||
| 'blueBright'
|
||||
| 'magentaBright'
|
||||
| 'cyanBright'
|
||||
| 'whiteBright',
|
||||
string
|
||||
>;
|
||||
|
||||
/**
|
||||
Style of the box border.
|
||||
|
||||
@default BorderStyle.Single
|
||||
*/
|
||||
readonly borderStyle?: BorderStyle | CustomBorderStyle;
|
||||
|
||||
/**
|
||||
Reduce opacity of the border.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly dimBorder?: boolean;
|
||||
|
||||
/**
|
||||
Space between the text and box border.
|
||||
|
||||
@default 0
|
||||
*/
|
||||
readonly padding?: number | Spacing;
|
||||
|
||||
/**
|
||||
Space around the box.
|
||||
|
||||
@default 0
|
||||
*/
|
||||
readonly margin?: number | Spacing;
|
||||
|
||||
/**
|
||||
Float the box on the available terminal screen space.
|
||||
|
||||
@default 'left'
|
||||
*/
|
||||
readonly float?: 'left' | 'right' | 'center';
|
||||
|
||||
/**
|
||||
Color of the background.
|
||||
*/
|
||||
readonly backgroundColor?: LiteralUnion<
|
||||
| 'black'
|
||||
| 'red'
|
||||
| 'green'
|
||||
| 'yellow'
|
||||
| 'blue'
|
||||
| 'magenta'
|
||||
| 'cyan'
|
||||
| 'white'
|
||||
| 'blackBright'
|
||||
| 'redBright'
|
||||
| 'greenBright'
|
||||
| 'yellowBright'
|
||||
| 'blueBright'
|
||||
| 'magentaBright'
|
||||
| 'cyanBright'
|
||||
| 'whiteBright',
|
||||
string
|
||||
>;
|
||||
|
||||
/**
|
||||
Align the text in the box based on the widest line.
|
||||
|
||||
@default 'left'
|
||||
*/
|
||||
readonly align?: 'left' | 'right' | 'center';
|
||||
}
|
||||
}
|
||||
|
||||
declare const enum BorderStyle {
|
||||
Single = 'single',
|
||||
Double = 'double',
|
||||
Round = 'round',
|
||||
Bold = 'bold',
|
||||
SingleDouble = 'singleDouble',
|
||||
DoubleSingle = 'doubleSingle',
|
||||
Classic = 'classic'
|
||||
}
|
||||
|
||||
declare const boxen: {
|
||||
/**
|
||||
Creates a box in the terminal.
|
||||
|
||||
@param text - The text inside the box.
|
||||
@returns The box.
|
||||
|
||||
@example
|
||||
```
|
||||
import boxen = require('boxen');
|
||||
|
||||
console.log(boxen('unicorn', {padding: 1}));
|
||||
// ┌─────────────┐
|
||||
// │ │
|
||||
// │ unicorn │
|
||||
// │ │
|
||||
// └─────────────┘
|
||||
|
||||
console.log(boxen('unicorn', {padding: 1, margin: 1, borderStyle: 'double'}));
|
||||
//
|
||||
// ╔═════════════╗
|
||||
// ║ ║
|
||||
// ║ unicorn ║
|
||||
// ║ ║
|
||||
// ╚═════════════╝
|
||||
//
|
||||
```
|
||||
*/
|
||||
(text: string, options?: boxen.Options): string;
|
||||
|
||||
/**
|
||||
Border styles from [`cli-boxes`](https://github.com/sindresorhus/cli-boxes).
|
||||
*/
|
||||
BorderStyle: typeof BorderStyle;
|
||||
|
||||
// TODO: Remove this for the next major release
|
||||
default: typeof boxen;
|
||||
};
|
||||
|
||||
export = boxen;
|
141
node_modules/boxen/index.js
generated
vendored
Normal file
141
node_modules/boxen/index.js
generated
vendored
Normal file
|
@ -0,0 +1,141 @@
|
|||
'use strict';
|
||||
const stringWidth = require('string-width');
|
||||
const chalk = require('chalk');
|
||||
const widestLine = require('widest-line');
|
||||
const cliBoxes = require('cli-boxes');
|
||||
const camelCase = require('camelcase');
|
||||
const ansiAlign = require('ansi-align');
|
||||
const termSize = require('term-size');
|
||||
|
||||
const getObject = detail => {
|
||||
let obj;
|
||||
|
||||
if (typeof detail === 'number') {
|
||||
obj = {
|
||||
top: detail,
|
||||
right: detail * 3,
|
||||
bottom: detail,
|
||||
left: detail * 3
|
||||
};
|
||||
} else {
|
||||
obj = Object.assign({
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0
|
||||
}, detail);
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
const getBorderChars = borderStyle => {
|
||||
const sides = [
|
||||
'topLeft',
|
||||
'topRight',
|
||||
'bottomRight',
|
||||
'bottomLeft',
|
||||
'vertical',
|
||||
'horizontal'
|
||||
];
|
||||
|
||||
let chars;
|
||||
|
||||
if (typeof borderStyle === 'string') {
|
||||
chars = cliBoxes[borderStyle];
|
||||
|
||||
if (!chars) {
|
||||
throw new TypeError(`Invalid border style: ${borderStyle}`);
|
||||
}
|
||||
} else {
|
||||
sides.forEach(key => {
|
||||
if (!borderStyle[key] || typeof borderStyle[key] !== 'string') {
|
||||
throw new TypeError(`Invalid border style: ${key}`);
|
||||
}
|
||||
});
|
||||
|
||||
chars = borderStyle;
|
||||
}
|
||||
|
||||
return chars;
|
||||
};
|
||||
|
||||
const isHex = color => color.match(/^#[0-f]{3}(?:[0-f]{3})?$/i);
|
||||
const isColorValid = color => typeof color === 'string' && ((chalk[color]) || isHex(color));
|
||||
const getColorFn = color => isHex(color) ? chalk.hex(color) : chalk[color];
|
||||
const getBGColorFn = color => isHex(color) ? chalk.bgHex(color) : chalk[camelCase(['bg', color])];
|
||||
|
||||
const boxen = (text, opts) => {
|
||||
opts = Object.assign({
|
||||
padding: 0,
|
||||
borderStyle: 'single',
|
||||
dimBorder: false,
|
||||
align: 'left',
|
||||
float: 'left'
|
||||
}, opts);
|
||||
|
||||
if (opts.borderColor && !isColorValid(opts.borderColor)) {
|
||||
throw new Error(`${opts.borderColor} is not a valid borderColor`);
|
||||
}
|
||||
|
||||
if (opts.backgroundColor && !isColorValid(opts.backgroundColor)) {
|
||||
throw new Error(`${opts.backgroundColor} is not a valid backgroundColor`);
|
||||
}
|
||||
|
||||
const chars = getBorderChars(opts.borderStyle);
|
||||
const padding = getObject(opts.padding);
|
||||
const margin = getObject(opts.margin);
|
||||
|
||||
const colorizeBorder = x => {
|
||||
const ret = opts.borderColor ? getColorFn(opts.borderColor)(x) : x;
|
||||
return opts.dimBorder ? chalk.dim(ret) : ret;
|
||||
};
|
||||
|
||||
const colorizeContent = x => opts.backgroundColor ? getBGColorFn(opts.backgroundColor)(x) : x;
|
||||
|
||||
text = ansiAlign(text, {align: opts.align});
|
||||
|
||||
const NL = '\n';
|
||||
const PAD = ' ';
|
||||
|
||||
let lines = text.split(NL);
|
||||
|
||||
if (padding.top > 0) {
|
||||
lines = new Array(padding.top).fill('').concat(lines);
|
||||
}
|
||||
|
||||
if (padding.bottom > 0) {
|
||||
lines = lines.concat(new Array(padding.bottom).fill(''));
|
||||
}
|
||||
|
||||
const contentWidth = widestLine(text) + padding.left + padding.right;
|
||||
const paddingLeft = PAD.repeat(padding.left);
|
||||
const {columns} = termSize();
|
||||
let marginLeft = PAD.repeat(margin.left);
|
||||
|
||||
if (opts.float === 'center') {
|
||||
const padWidth = Math.max((columns - contentWidth) / 2, 0);
|
||||
marginLeft = PAD.repeat(padWidth);
|
||||
} else if (opts.float === 'right') {
|
||||
const padWidth = Math.max(columns - contentWidth - margin.right - 2, 0);
|
||||
marginLeft = PAD.repeat(padWidth);
|
||||
}
|
||||
|
||||
const horizontal = chars.horizontal.repeat(contentWidth);
|
||||
const top = colorizeBorder(NL.repeat(margin.top) + marginLeft + chars.topLeft + horizontal + chars.topRight);
|
||||
const bottom = colorizeBorder(marginLeft + chars.bottomLeft + horizontal + chars.bottomRight + NL.repeat(margin.bottom));
|
||||
const side = colorizeBorder(chars.vertical);
|
||||
|
||||
const middle = lines.map(line => {
|
||||
const paddingRight = PAD.repeat(contentWidth - stringWidth(line) - padding.left);
|
||||
return marginLeft + side + colorizeContent(paddingLeft + line + paddingRight) + side;
|
||||
}).join(NL);
|
||||
|
||||
return top + NL + middle + NL + bottom;
|
||||
};
|
||||
|
||||
module.exports = boxen;
|
||||
// TODO: Remove this for the next major release
|
||||
module.exports.default = boxen;
|
||||
|
||||
module.exports._borderStyles = cliBoxes;
|
9
node_modules/boxen/license
generated
vendored
Normal file
9
node_modules/boxen/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
82
node_modules/boxen/package.json
generated
vendored
Normal file
82
node_modules/boxen/package.json
generated
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
{
|
||||
"_from": "boxen@^3.0.0",
|
||||
"_id": "boxen@3.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-cU4J/+NodM3IHdSL2yN8bqYqnmlBTidDR4RC7nJs61ZmtGz8VZzM3HLQX0zY5mrSmPtR3xWwsq2jOUQqFZN8+A==",
|
||||
"_location": "/boxen",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "boxen@^3.0.0",
|
||||
"name": "boxen",
|
||||
"escapedName": "boxen",
|
||||
"rawSpec": "^3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/update-notifier"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/boxen/-/boxen-3.2.0.tgz",
|
||||
"_shasum": "fbdff0de93636ab4450886b6ff45b92d098f45eb",
|
||||
"_spec": "boxen@^3.0.0",
|
||||
"_where": "/home/shimataro/projects/actions/ssh-key-action/node_modules/update-notifier",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/boxen/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"ansi-align": "^3.0.0",
|
||||
"camelcase": "^5.3.1",
|
||||
"chalk": "^2.4.2",
|
||||
"cli-boxes": "^2.2.0",
|
||||
"string-width": "^3.0.0",
|
||||
"term-size": "^1.2.0",
|
||||
"type-fest": "^0.3.0",
|
||||
"widest-line": "^2.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Create boxes in the terminal",
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"nyc": "^13.3.0",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/boxen#readme",
|
||||
"keywords": [
|
||||
"cli",
|
||||
"box",
|
||||
"boxes",
|
||||
"terminal",
|
||||
"term",
|
||||
"console",
|
||||
"ascii",
|
||||
"unicode",
|
||||
"border",
|
||||
"text"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "boxen",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/boxen.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava && tsd"
|
||||
},
|
||||
"version": "3.2.0"
|
||||
}
|
188
node_modules/boxen/readme.md
generated
vendored
Normal file
188
node_modules/boxen/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,188 @@
|
|||
# boxen [](https://travis-ci.org/sindresorhus/boxen)
|
||||
|
||||
> Create boxes in the terminal
|
||||
|
||||

|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install boxen
|
||||
```
|
||||
|
||||
<a href="https://www.patreon.com/sindresorhus">
|
||||
<img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160">
|
||||
</a>
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const boxen = require('boxen');
|
||||
|
||||
console.log(boxen('unicorn', {padding: 1}));
|
||||
/*
|
||||
┌─────────────┐
|
||||
│ │
|
||||
│ unicorn │
|
||||
│ │
|
||||
└─────────────┘
|
||||
*/
|
||||
|
||||
console.log(boxen('unicorn', {padding: 1, margin: 1, borderStyle: 'double'}));
|
||||
/*
|
||||
|
||||
╔═════════════╗
|
||||
║ ║
|
||||
║ unicorn ║
|
||||
║ ║
|
||||
╚═════════════╝
|
||||
|
||||
*/
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### boxen(text, [options])
|
||||
|
||||
#### text
|
||||
|
||||
Type: `string`
|
||||
|
||||
Text inside the box.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### borderColor
|
||||
|
||||
Type: `string`<br>
|
||||
Values: `black` `red` `green` `yellow` `blue` `magenta` `cyan` `white` `gray` or a hex value like `#ff0000`
|
||||
|
||||
Color of the box border.
|
||||
|
||||
##### borderStyle
|
||||
|
||||
Type: `string | object`<br>
|
||||
Default: `single`<br>
|
||||
Values:
|
||||
- `single`
|
||||
```
|
||||
┌───┐
|
||||
│foo│
|
||||
└───┘
|
||||
```
|
||||
- `double`
|
||||
```
|
||||
╔═══╗
|
||||
║foo║
|
||||
╚═══╝
|
||||
```
|
||||
- `round` (`single` sides with round corners)
|
||||
```
|
||||
╭───╮
|
||||
│foo│
|
||||
╰───╯
|
||||
```
|
||||
- `bold`
|
||||
```
|
||||
┏━━━┓
|
||||
┃foo┃
|
||||
┗━━━┛
|
||||
```
|
||||
- `single-double` (`single` on top and bottom, `double` on right and left)
|
||||
```
|
||||
╓───╖
|
||||
║foo║
|
||||
╙───╜
|
||||
```
|
||||
- `double-single` (`double` on top and bottom, `single` on right and left)
|
||||
```
|
||||
╒═══╕
|
||||
│foo│
|
||||
╘═══╛
|
||||
```
|
||||
- `classic`
|
||||
```
|
||||
+---+
|
||||
|foo|
|
||||
+---+
|
||||
```
|
||||
|
||||
Style of the box border.
|
||||
|
||||
Can be any of the above predefined styles or an object with the following keys:
|
||||
|
||||
```js
|
||||
{
|
||||
topLeft: '+',
|
||||
topRight: '+',
|
||||
bottomLeft: '+',
|
||||
bottomRight: '+',
|
||||
horizontal: '-',
|
||||
vertical: '|'
|
||||
}
|
||||
```
|
||||
|
||||
##### dimBorder
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
Reduce opacity of the border.
|
||||
|
||||
##### padding
|
||||
|
||||
Type: `number | object`<br>
|
||||
Default: `0`
|
||||
|
||||
Space between the text and box border.
|
||||
|
||||
Accepts a number or an object with any of the `top`, `right`, `bottom`, `left` properties. When a number is specified, the left/right padding is 3 times the top/bottom to make it look nice.
|
||||
|
||||
##### margin
|
||||
|
||||
Type: `number | object`<br>
|
||||
Default: `0`
|
||||
|
||||
Space around the box.
|
||||
|
||||
Accepts a number or an object with any of the `top`, `right`, `bottom`, `left` properties. When a number is specified, the left/right margin is 3 times the top/bottom to make it look nice.
|
||||
|
||||
##### float
|
||||
|
||||
Type: `string`<br>
|
||||
Values: `right` `center` `left`<br>
|
||||
Default: `left`
|
||||
|
||||
Float the box on the available terminal screen space.
|
||||
|
||||
##### backgroundColor
|
||||
|
||||
Type: `string`
|
||||
Values: `black` `red` `green` `yellow` `blue` `magenta` `cyan` `white` `gray` or a hex value like `#ff0000`
|
||||
|
||||
Color of the background.
|
||||
|
||||
##### align
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `left`<br>
|
||||
Values: `left` `center` `right`
|
||||
|
||||
Align the text in the box based on the widest line.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [boxen-cli](https://github.com/sindresorhus/boxen-cli) - CLI for this module
|
||||
- [cli-boxes](https://github.com/sindresorhus/cli-boxes) - Boxes for use in the terminal
|
||||
- [ink-box](https://github.com/sindresorhus/ink-box) - Box component for Ink that uses this package
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
Loading…
Add table
Add a link
Reference in a new issue