initial commit of actions
This commit is contained in:
commit
949ece5785
44660 changed files with 12034344 additions and 0 deletions
21
github/codeql-action-v2/node_modules/gar/LICENSE
generated
vendored
Executable file
21
github/codeql-action-v2/node_modules/gar/LICENSE
generated
vendored
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2018 Ethan Davis
|
||||
|
||||
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.
|
||||
48
github/codeql-action-v2/node_modules/gar/README.md
generated
vendored
Executable file
48
github/codeql-action-v2/node_modules/gar/README.md
generated
vendored
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
# gar
|
||||
> The lightweight Node arguments parser
|
||||
|
||||
[GitHub](https://github.com/ethanent/gar) | [NPM](https://www.npmjs.com/package/gar)
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm i gar
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||

|
||||
|
||||
```javascript
|
||||
const args = require('gar')(process.argv.slice(2))
|
||||
|
||||
console.log(args)
|
||||
```
|
||||
|
||||
So for: `-h hey --toggle -ac --hey=hi -spaced "hey there" -num 1 lone`
|
||||
|
||||
```json
|
||||
{
|
||||
"h": "hey",
|
||||
"toggle": true,
|
||||
"a": true,
|
||||
"c": true,
|
||||
"hey": "hi",
|
||||
"spaced": "hey there",
|
||||
"num": 1,
|
||||
"_": ["lone"]
|
||||
}
|
||||
```
|
||||
|
||||
## Why use gar?
|
||||
|
||||
gar is way more lightweight than other argument parsing packages.
|
||||
|
||||
Here's a size comparison table:
|
||||
|
||||
Package | Size
|
||||
--- | ---
|
||||
optimist | [](https://packagephobia.now.sh/result?p=optimist)
|
||||
minimist | [](https://packagephobia.now.sh/result?p=minimist)
|
||||
args-parser | [](https://packagephobia.now.sh/result?p=args-parser)
|
||||
gar | [](https://packagephobia.now.sh/result?p=gar)
|
||||
36
github/codeql-action-v2/node_modules/gar/index.js
generated
vendored
Executable file
36
github/codeql-action-v2/node_modules/gar/index.js
generated
vendored
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
module.exports = (sargs) => {
|
||||
let props = {}
|
||||
let lones = []
|
||||
|
||||
const convertIfApplicable = (value) => (isNaN(value) ? (value.toString().toLowerCase() === 'true' ? true : (value.toString().toLowerCase() === 'false' ? false : value)) : Number(value))
|
||||
const removeStartHyphens = (value) => value.replace(/^\-+/g, '')
|
||||
|
||||
for (let i = 0; i < sargs.length; i++) {
|
||||
const equalsIndex = sargs[i].indexOf('=')
|
||||
const isNextRefProp = sargs[i].charAt(0) === '-' && sargs.length - 1 >= i + 1 && sargs[i + 1].indexOf('=') === -1 && sargs[i + 1].charAt(0) !== '-'
|
||||
const argName = equalsIndex === -1 ? removeStartHyphens(sargs[i]) : removeStartHyphens(sargs[i].slice(0, equalsIndex))
|
||||
|
||||
if (equalsIndex !== -1) {
|
||||
props[argName] = convertIfApplicable(sargs[i].slice(equalsIndex + 1))
|
||||
}
|
||||
else if (isNextRefProp) {
|
||||
props[argName] = convertIfApplicable(sargs[i + 1])
|
||||
i++
|
||||
} else if (sargs[i].charAt(0) === '-') {
|
||||
if (sargs[i].charAt(1) === '-') {
|
||||
props[argName] = true
|
||||
}
|
||||
else {
|
||||
for (let b = 0; b < argName.length; b++) {
|
||||
props[argName.charAt(b)] = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
lones.push(convertIfApplicable(argName))
|
||||
}
|
||||
}
|
||||
|
||||
return Object.assign(props, {
|
||||
'_': lones
|
||||
})
|
||||
}
|
||||
39
github/codeql-action-v2/node_modules/gar/package.json
generated
vendored
Executable file
39
github/codeql-action-v2/node_modules/gar/package.json
generated
vendored
Executable file
|
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"name": "gar",
|
||||
"version": "1.0.4",
|
||||
"description": "The lightweight Node arguments parser",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Tested before deployment.\" && exit 0",
|
||||
"test-dev": "npm install && node test.js",
|
||||
"prepublishOnly": "npm run test-dev"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ethanent/gar.git"
|
||||
},
|
||||
"keywords": [
|
||||
"argument",
|
||||
"args",
|
||||
"argv",
|
||||
"parse",
|
||||
"cli",
|
||||
"command-line",
|
||||
"parser",
|
||||
"command",
|
||||
"lightweight"
|
||||
],
|
||||
"author": "Ethan Davis",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ethanent/gar/issues"
|
||||
},
|
||||
"homepage": "https://github.com/ethanent/gar#readme",
|
||||
"devDependencies": {
|
||||
"whew": "^1.1.3"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"LICENSE"
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue