Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI #1

Merged
merged 7 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 6 additions & 7 deletions README.md
Expand Up @@ -16,7 +16,7 @@ This "Yoshi!" may be a flag that something bad is about to happen!
         ∠__╋__〉
        /  ①八① \
        工ニ f(_人_) エ |′
        \ ヽノ ノ ヘ
        \ ヽノ ノ ヘ
      ⊂⌒)_>―――イ (_) /
       `ー、_ノ/ ̄ヽ |/
         _||  | |
Expand Down Expand Up @@ -77,29 +77,28 @@ $ yarn add genbaneko
## Usage

```javascript
import { genbaneko , mGenbaneko } from 'genbaneko';
import { genbaneko, mGenbaneko } from 'genbaneko';
// or
const { genbaneko , mGenbaneko } = require('genbaneko');
const { genbaneko, mGenbaneko } = require('genbaneko');

// Only on-site cats are output
genbaneko();
mGenbaneko.nomal();

// Use this when you want your cat to speak or think
mGenbaneko.think("Hello");
mGenbaneko.say("WTF");
mGenbaneko.think('Hello');
mGenbaneko.say('WTF');

// It works without any text arguments.
// In that case, "Yoshi !!" is displayed by default.
mGenbaneko.think();
mGenbaneko.say();

```

"Yoshi !!" is a Japanese word for "challenging during confirmation work".
It is used in Japan as a net meme when bad things happen.
If the code for your project doesn't work, write a comment saying "なんだか知らんがとにかくよし! "


That's all there is to it.
Pull requests to add other kinds of "genbaneko" are welcome!
See [ToDo](#ToDo) for features we would like to add.
Expand Down
3 changes: 3 additions & 0 deletions bin/index.js
@@ -0,0 +1,3 @@
#!/usr/bin/env node
const { cli } = require('../dist/cli.js');
cli(process.argv);
4 changes: 0 additions & 4 deletions dist/bin/index.js

This file was deleted.

37 changes: 37 additions & 0 deletions dist/cli.js
@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cli = void 0;
const commander_1 = require("commander");
const _1 = require(".");
const CLI_VERSION = '0.0.0';
/**
* Run the command line interface program.
* @param argv process.argv.
*/
const cli = (argv) => {
if (process.argv.length === 2) {
_1.mGenbaneko.nomal();
return;
}
const program = new commander_1.Command();
program
.name('genbaneko')
.description(`Let's display "Yoshi!" on the console.`)
.version(CLI_VERSION);
program
.command('say')
.description('say something')
.argument('[string]', 'serif')
.action((serif) => {
_1.mGenbaneko.say(serif);
});
program
.command('think')
.description('think something')
.argument('[string]', 'thought')
.action((thought) => {
_1.mGenbaneko.think(thought);
});
program.parse(argv);
};
exports.cli = cli;
6 changes: 6 additions & 0 deletions dist/esm/cli.d.ts
@@ -0,0 +1,6 @@
/**
* Run the command line interface program.
* @param argv process.argv.
*/
export declare const cli: (argv: string[]) => void;
//# sourceMappingURL=cli.d.ts.map
1 change: 1 addition & 0 deletions dist/esm/cli.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions dist/esm/cli.js
@@ -0,0 +1,33 @@
import { Command } from 'commander';
import { mGenbaneko } from '.';
const CLI_VERSION = '0.0.0';
/**
* Run the command line interface program.
* @param argv process.argv.
*/
export const cli = (argv) => {
if (process.argv.length === 2) {
mGenbaneko.nomal();
return;
}
const program = new Command();
program
.name('genbaneko')
.description(`Let's display "Yoshi!" on the console.`)
.version(CLI_VERSION);
program
.command('say')
.description('say something')
.argument('[string]', 'serif')
.action((serif) => {
mGenbaneko.say(serif);
});
program
.command('think')
.description('think something')
.argument('[string]', 'thought')
.action((thought) => {
mGenbaneko.think(thought);
});
program.parse(argv);
};
16 changes: 15 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -38,7 +38,7 @@
"dist"
],
"bin": {
"genbaneko": "dist/bin/index.js"
"genbaneko": "bin/index.js"
},
"engines": {
"node": ">=14"
Expand All @@ -60,6 +60,7 @@
"url": "https://github.com/moons-14"
},
"dependencies": {
"commander": "^9.4.0",
"cowsayjs": "^1.0.7"
}
}
2 changes: 0 additions & 2 deletions src/bin/index.ts

This file was deleted.

39 changes: 39 additions & 0 deletions src/cli.ts
@@ -0,0 +1,39 @@
import { Command } from 'commander';
import { mGenbaneko } from '.';

const CLI_VERSION = '0.0.0';

/**
* Run the command line interface program.
* @param argv process.argv.
*/
export const cli = (argv: string[]) => {
if (process.argv.length === 2) {
mGenbaneko.nomal();
return;
}
const program = new Command();

program
.name('genbaneko')
.description(`Let's display "Yoshi!" on the console.`)
.version(CLI_VERSION);

program
.command('say')
.description('say something')
.argument('[string]', 'serif')
.action((serif) => {
mGenbaneko.say(serif);
});

program
.command('think')
.description('think something')
.argument('[string]', 'thought')
.action((thought) => {
mGenbaneko.think(thought);
});

program.parse(argv);
};
2 changes: 1 addition & 1 deletion src/index.ts
@@ -1,4 +1,4 @@
import { perform, say, think } from 'cowsayjs/lib/box';
import { say, think } from 'cowsayjs/lib/box';
export const genbaneko = () => {
console.log(
'          ∧  /ヽ\n         // ̄ ̄\|\n         ∠__╋__〉\n        /  ①八① \\n        工ニ f(_人_) エ |′\n        \ ヽノ ノ ヘ \n      ⊂⌒)_>―――イ (_) /\n       `ー、_ノ/ ̄ヽ |/\n         _||  | |\n        (  人_ノ Λ\n         \ス ̄ ̄レ-Λ \\n        ( ̄ ) / / \ノ\\n          ̄ ̄ ( ヽ  \_)\n            \ノ'
Expand Down
13 changes: 3 additions & 10 deletions tsconfig.json
Expand Up @@ -5,16 +5,9 @@
"moduleResolution": "Node",
"esModuleInterop": true,
"strict": true,
"lib": [
"ESNext"
],
"types": [
"node",
"jest"
],
"lib": ["ESNext"],
"types": ["node", "jest"],
"outDir": "dist"
},
"include": [
"src"
]
"include": ["src"]
}