Skip to content

Commit

Permalink
feat: added the human-readable outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
kurone-kito committed May 12, 2021
1 parent c048f65 commit 46ea07b
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 6 deletions.
95 changes: 95 additions & 0 deletions packages/dantalion-cli/README.md
Expand Up @@ -27,13 +27,46 @@ npm install -g @kurone-kito/dantalion-cli

### Get the personality

#### If you want the **human-readable** result (Markdown)

NOTE: It omits some minor information.

```sh
dantalion personality 1993-10-09
```

<!-- markdownlint-disable MD033 -->
<details><summary>Result</summary>

```md
# Dantalion: 誕生日が Sat Oct 09 1993 の人の性格と、取扱方法

## 性格の大分類

人の性格は大きく 3 つ、アート脳タイプ・理系脳タイプ・文系脳タイプに分類できます。

### 理系脳タイプ

* 己の富のためを根底のエゴとし、効率性を追求するタイプです。
* スペック至上主義の傾向があり、ブランドものを軽視する傾向が強いです。ただし、ブランドも一種のスペックと考え、重視する人も稀にいます。
* 理系脳タイプは、長話をあまり聞けません。「つまりこういうことだよね?」と、脳内で要点だけかいつまんで理解しようとします。

:
:
```

</details>
<!-- markdownlint-enable MD033 -->

#### If you want the **JSON formatted** result

```sh
dantalion personality --raw 1993-10-09
```

<!-- markdownlint-disable MD033 -->
<details><summary>Result</summary>

```json
{
"cycle": 10,
Expand All @@ -50,13 +83,46 @@ dantalion personality 1993-10-09

### Get detailed information on personality

#### If you want the **human-readable** result (Markdown)

NOTE: It omits some minor information.

```sh
dantalion details 555
```

<!-- markdownlint-disable MD033 -->
<details><summary>Result</summary>

```md
# Dantalion: 性格タイプ 555 の詳細、および取扱方法

## 性格の大分類

人の性格は大きく 3 つ、アート脳タイプ・理系脳タイプ・文系脳タイプに分類できます。

### 理系脳タイプ

* 己の富のためを根底のエゴとし、効率性を追求するタイプです。
* スペック至上主義の傾向があり、ブランドものを軽視する傾向が強いです。ただし、ブランドも一種のスペックと考え、重視する人も稀にいます。
* 理系脳タイプは、長話をあまり聞けません。「つまりこういうことだよね?」と、脳内で要点だけかいつまんで理解しようとします。

:
:
```

</details>
<!-- markdownlint-enable MD033 -->

#### If you want the **JSON formatted** result

```sh
dantalion details --raw 555
```

<!-- markdownlint-disable MD033 -->
<details><summary>Result</summary>

```json
{
"affinity": {
Expand Down Expand Up @@ -102,6 +168,35 @@ dantalion details 555
</details>
<!-- markdownlint-enable MD033 -->

### Get the types list of personality

```sh
dantalion details
```

<!-- markdownlint-disable MD033 -->
<details><summary>Result</summary>

```md
# Dantalion: 有効な性格タイプ一覧

* 000
* 001
* 012
* 024
* 025
* 100
* 108
* 125
* 555
* 789
* 888
* 919
```

</details>
<!-- markdownlint-enable MD033 -->

## See also

- [See the wiki for more details.](https://github.com/kurone-kito/dantalion/wiki)
Expand Down
19 changes: 13 additions & 6 deletions packages/dantalion-cli/src/index.ts
Expand Up @@ -5,13 +5,20 @@ import { version } from '../package.json';
import detail from './detail';
import personality from './personality';
import showJson from './render/showJson';
import showMd from './render/showMd';

[detail, personality].forEach(({ getObject, alias, command, description }) =>
commander
.command(command)
.alias(alias)
.description(description)
.action(async (...args) => showJson(await getObject(...args)))
[detail, personality].forEach(
({ getDescriptionAsync, getObject, alias, command, description }) =>
commander
.command(command)
.alias(alias)
.option('-r, --raw', 'Returns the raw JSON')
.description(description)
.action(async (arg, { raw }) =>
!raw
? showMd(await getDescriptionAsync(arg))
: showJson(await getObject(arg))
)
);

commander.version(version);
Expand Down

0 comments on commit 46ea07b

Please sign in to comment.