# blog-tool

> help to write blog with markdown & generate data like index/classification

Latest version **1.0.1** (published 2020-01-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install blog-tool
pnpm add blog-tool
yarn add blog-tool
bun add blog-tool
```

Provides the command `blog-tool`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-01-25 |
| First published | 2019-07-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 94.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | kabiwo |
| Maintainers | kabiwo |
| Keywords | blog, markdown |

## Links

- npm: https://www.npmjs.com/package/blog-tool
- Repository: https://github.com/cyx7788414/blog-tool
- Homepage: https://github.com/cyx7788414/blog-tool#readme
- Issues: https://github.com/cyx7788414/blog-tool/issues
- npm.io page: https://npm.io/package/blog-tool

## Dependencies (8)

- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [yargs](https://npm.io/package/yargs.md) ^13.3.0
- [moment](https://npm.io/package/moment.md) ^2.24.0
- [rimraf](https://npm.io/package/rimraf.md) ^2.7.1
- [inquirer](https://npm.io/package/inquirer.md) ^6.5.2
- [@types/yargs](https://npm.io/package/@types/yargs.md) ^13.0.4
- [@types/rimraf](https://npm.io/package/@types/rimraf.md) ^2.0.3
- [@types/inquirer](https://npm.io/package/@types/inquirer.md) ^6.5.0

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2020-01-25
- 1.0.0 — 2019-07-30

## README

# Blog Tool  
a blog tool base on command line 
help you to manange you article data  

# Github  
[blog-tool](https://github.com/cyx7788414/blog-tool)

# Install  
```bash
    npm install blog-tool
```
install this package as global will be better

# Usage  
```bash
    blog-tool --help
```

# Documentation

## Dictionary

+ **Base Path**: The root folder for article data
+ **Index File**: A **JSON** file which records all article's index information, just store under **Base Path**
+ **Articles Folder**: A folder storage the article's source file, at the same level of **Index File**
+ **Article File**: A **md** fild which record the article text, at the path relative to **Base Path** as `./articles/${yyyy}/${MM}/${id}`
+ **Type**: The top category for a article, which can only have one type
+ **Tag**: Attributes for a article, a article an have multiple tag
+ **Date String**: Date string, which can be parsed by new Date()

## File Structure Of Base Path

```shell
.
├── articles
│   └── 2019
│       └── 12
│           ├── 1
│           │   └── article.md  
│           └── 2
│               └── article.md
└── index.json
```

## Data Structure Of Index File

```javascript
{
    "types": [ // type list
        {
            "id": 0,
            "name": "test" // name
        }
    ],
    "tags": [ // tag list
        {
            "name": "test", // name
            "id": 0
        }
    ],
    "articles": [ // article list
        {
            "id": 1,
            "name": "test2", // title
            "type": 0, // type
            "tag": [  //tage list
                0
            ],
            "path": "./articles/2019/12/1", // the path of article.md relative to base path, the rule is `./articles/${yyyy}/${MM}/${id}`
            "auther": "", // auther
            "create": 1577699385273, // create time
            "update": 1577699385462, // update time
            "status": 0 // 0: editing, 1: published, 2: deleted
        }
    ]
}
```

## Command

The sub command of blog-tool is listed below

### init

Init a folder for article data

#### param

+ **path**: Set the **Base Path** string to init article data, alias 'p', default './'

### add

Add a new article

#### param

+ **path**: Set the **Base Path** string to init article data, alias 'p', default './'
+ **name**: Set the title of article, alias 'n', required
+ **date**: Set the create **Date String**, alias 'd'
+ **auther**: Set the auther string of article, alias 'a'

### update

Update some info of one article, set update time automatically

#### param

+ **path**: Set the path string which contain **Article File** to update article data, alias 'p', default './'
+ **name**: Reset the title of article, alias 'n'
+ **auther**: Reset the auther string of article, alias 'a

### delete

Delete a atricle or mark it's status as deleted

#### param

+ **path**: Set the path string which contain **Article File** to delete article data, alias 'p', default './'
+ **force**: Make choice to delete article data or marke it's status as deleted, alias 'f', default false

### attr

Choice and manage article attributes like **Type** and **Tag** in a **Base Path**, you can list/rename/delete them, independent params can only be used independently

#### param

+ **path**: Set the **Base Path** string, alias 'p', default './'
+ **list**: Show the list of target group, alias 'l', default false
+ **rename**: Choice one item in target group to rename it, alias 'r', default false
+ **delete**: Choice part of target group to delete them, alias 'd', default false

### search

Search atricle with selected attributes

#### param

+ **path**: Set the **Base Path** string, alias 'p', default './'
+ **tag**: Add substr of tag to search condition, alias 'ta'
+ **type**: Add substr of type to search condition, alias 'ty'
+ **name**: Add substr of name to search condition, alias 'n'
+ **auther**: Add substr of auther to search condition, alias 'a'
+ **earlistcreate**: Add earlist create **Date String** to search condition, alias 'ec'
+ **latestcreate**: Add latest create **Date String** to search condition, alias 'lc'
+ **earlistupdate**: Add earlist update **Date String** to search condition, alias 'eu'
+ **latestupdate**: Add latest update **Date String** to search condition, alias 'lu'
+ **stataus**: Add substr of status to search condition, alias 's'

---
_Source: https://npm.io/package/blog-tool · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
