1
mirror of https://github.com/jakejarvis/jakejarvis.git synced 2025-06-29 07:45:42 -04:00

move CLI code into this repo

This commit is contained in:
2021-01-30 09:52:18 -05:00
parent a03f53154b
commit e59e5f23bb
10 changed files with 2356 additions and 0 deletions

1
cli/.gitignore vendored Executable file
View File

@ -0,0 +1 @@
node_modules/

9
cli/LICENSE.md Executable file
View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) Jake Jarvis <jake@jarv.is> (https://jarv.is/), 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.

25
cli/README.md Executable file
View File

@ -0,0 +1,25 @@
# 🧑🏻‍💻 @jakejarvis/cli [![npm (scoped)](https://img.shields.io/npm/v/@jakejarvis/cli?color=ff69b4&logo=npm)](https://www.npmjs.com/package/@jakejarvis/cli) [![CI status](https://github.com/jakejarvis/jakejarvis/workflows/CLI:%20Test/badge.svg)](https://github.com/jakejarvis/jakejarvis/actions)
> The [Jake Jarvis](https://jarv.is/) CLI (aka the most useless Node module ever published, in history, by anyone, ever).
<p align="center"><img src="https://raw.githubusercontent.com/jakejarvis/jakejarvis/main/cli/screenshot.png" width="700"></p>
## Usage
```sh
$ npx @jakejarvis/cli
```
## Inspired by
- [@sindresorhus/sindresorhus](https://github.com/sindresorhus/sindresorhus)
- [@yg/ygcodes](https://github.com/yg/ygcodes)
## Built with
- [ink](https://github.com/vadimdemedes/ink) - React for interactive command-line apps
- [meow](https://github.com/sindresorhus/meow) - CLI helper
## License
MIT © [Jake Jarvis](https://jarv.is/), [Sindre Sorhus](https://sindresorhus.com)

72
cli/package.json Normal file
View File

@ -0,0 +1,72 @@
{
"name": "@jakejarvis/cli",
"version": "1.7.337",
"description": "The Jake Jarvis CLI",
"homepage": "https://jarv.is/cli/",
"bugs": "https://github.com/jakejarvis/jakejarvis/issues",
"license": "MIT",
"keywords": [
"cli",
"jakejarvis",
"jarvis",
"portfolio",
"useless"
],
"author": {
"name": "Jake Jarvis",
"email": "jake@jarv.is",
"url": "https://jarv.is/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/jakejarvis/jakejarvis.git"
},
"engines": {
"node": "^10 || ^12 || >=14"
},
"files": [
"src/*"
],
"bin": {
"jakejarvis": "./src/cli.js"
},
"scripts": {
"test": "eslint ./src/*.js",
"cli": "node ./src/cli.js"
},
"dependencies": {
"import-jsx": "^4.0.0",
"ink": "^3.0.8",
"ink-big-text": "^1.1.0",
"ink-gradient": "^2.0.0",
"ink-select-input": "^4.2.0",
"meow": "^9.0.0",
"open": "^7.3.1",
"react": "^16.x"
},
"devDependencies": {
"eslint": "^7.18.0",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0"
},
"eslintConfig": {
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended"
],
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module"
},
"env": {
"node": true,
"es6": true
},
"settings": {
"react": {
"version": "detect"
}
}
}
}

BIN
cli/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 KiB

17
cli/src/cli.js Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env node
'use strict';
const meow = require('meow');
const importJsx = require('import-jsx');
const React = require('react');
const {render} = require('ink');
const menu = importJsx('./menu');
meow(`
Usage
$ npx @jakejarvis/cli
`);
render(React.createElement(menu));

81
cli/src/menu.js Executable file
View File

@ -0,0 +1,81 @@
'use strict';
const React = require('react');
const {Box, Text} = require('ink');
const BigText = require('ink-big-text');
const Gradient = require('ink-gradient');
const SelectInput = require('ink-select-input').default;
const open = require('open');
const handleSelect = item => {
if (item.url) {
open(item.url);
}
if (item.action) {
item.action();
}
};
const createItems = items => {
for (const item of items) {
item.key = item.url || item.label;
}
return items;
};
const items = createItems([
{
label: '🌎 Website',
url: 'https://jarv.is/'
},
{
label: '📝 Blog',
url: 'https://jarv.is/notes/'
},
{
label: '💾 GitHub',
url: 'https://github.com/jakejarvis'
},
{
label: '🐦 Twitter',
url: 'https://twitter.com/intent/user?screen_name=jakejarvis'
},
{
label: '📬 Email',
url: 'mailto:jake@jarv.is'
},
{
label: '🔐 PGP Key',
url: 'https://jrvs.io/pubkey'
},
{
label: '👔 Résumé (PDF)',
url: 'https://jrvs.io/resume'
},
{
label: '🐼 Panda Party',
url: 'https://nationalzoo.si.edu/webcams/panda-cam#maincontent'
},
{
label: '🚪 Quit',
action() {
process.exit();
}
}
]);
const menu = () => (
<Box flexDirection="column">
<Gradient name="pastel">
<BigText text="Jake Jarvis"/>
</Gradient>
<Box marginBottom={1}>
<Text> Front-End Developer Bostonian Freelance Open-Sourcerer</Text>
</Box>
<SelectInput items={items} onSelect={handleSelect}/>
</Box>
);
module.exports = menu;

2077
cli/yarn.lock Normal file

File diff suppressed because it is too large Load Diff