1.0.36 • Published 4 years ago

@alrale/cli v1.0.36

Weekly downloads
619
License
MIT
Repository
-
Last release
4 years ago

@alrale/cli

终端常用小工具集合

  • init 下载模板
  • q 字典查询
  • ts 时间戳
  • calc 计算器
  • remote 远程
    • -r|--proverbs 一言数据
    • -b|--bing 必应壁纸
  • os 系统
    • -ip|--ipv4
    • -ip6|--ipv6
  • regular 正则
  • byte 字节转换
  • cmd shell操作
    • -l [args] 执行查询
  • pipe 管道符
    • -t 表格查看
    • -l 列表查看
    • execute 执行
  • website 常用网站
  • doc 接口文档转换
  • color 常用颜色Hex表
  • git commit emoji表

Install

$ npm install -g @alrale/cli

Usage

shelUsage: al [options] [command]

Options:
  -v, -version          output the version number
  -h, --help            display help for command

Commands:
  help                  帮助
  init                  初始化模板
  q <word|expressions>  翻译,查询中|英文单词,词句
  ts [timestamp]        格式化时间戳,默认查询当前时间
  calc|c                计算器
  remote|r [options]    远程获取, default: 获取一言数据
  os [options]          获取系统参数
  regular|reg           获取常用正则表达式
  byte                  字节转换
  cmd [options]         shell 操作
  pipe|p [options]      管道符常用命令 (| xargs [options] <command>)

Init 下载模板

$ al init     
? 模板选择 koa2-basic-template
✔ 安装完成!
cd koa2-basic-services-template
yarn 或者 npm install 安装依赖
yarn dev 启动开发环境

Q 字典查询

$ al q word
┌──────┬──────────────────────────────────────┬────────────────┬─────────────────────────┐
│ word │ n. [语] 单词;话语;消息;诺言;命令 │ vt. 用言辞表达 │ n. (Word)人名;(英)沃德 │
└──────┴──────────────────────────────────────┴────────────────┴─────────────────────────┘

Ts 时间戳

$ al ts 1577905445
┌────┬──────┬────┬────┬──────┬────┬────┬────┬──────┬─────────────────────┬────────────┐
│ \  │ 年   │ 月 │ 日 │ 星期 │ 时 │ 分 │ 秒 │ 毫秒 │ YMD Hms             │ timestamp  │
├────┼──────┼────┼────┼──────┼────┼────┼────┼──────┼─────────────────────┼────────────┤
│ 简 │ 2020 │ 1  │ 2  │ 4    │ 3  │ 4  │ 5  │ 0    │ 2020-1-2 3:4:5      │ 1577905445 │
├────┼──────┼────┼────┼──────┼────┼────┼────┼──────┼─────────────────────┼────────────┤
│ 繁 │ 2020 │ 01 │ 02 │ 4    │ 03 │ 04 │ 05 │ 0    │ 2020-01-02 03:04:05 │ 1577905445 │
└────┴──────┴────┴────┴──────┴────┴────┴────┴──────┴─────────────────────┴────────────┘

Calc 计算器

$ al c
? operator: +
<number>|q:quit|s:select|c:clear
 target: 1
<number>|q:quit|s:select|c:clear
 target: 2
3
<number>|q:quit|s:select|c:clear
 target: q
quit!

Remote 远程

$ al r -h
Usage: cli remote|r [options]

远程获取, default: 获取一言数据

Options:
  -p, --proverbs     箴言、言语、格言
  -b, --bing [page]  获取必应壁纸列表 [page]页数
  -h, --help         display help for command

-r|--proverbs一言数据

$ al r
伯牙鼓琴,志在高山 ———— 伯牙绝弦

-b|--bing 必应壁纸

$ al r -b [limit] # 获取必应的图片列表 可分页
$ al r -b
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ 1 德拉海滩Wakodahatchee湿地的大蓝鹭,佛罗里达州 (© Marie Hickman/Getty Images)                         │ https://www.bing.com/th?id=OHR.Wakodahatchee_ZH-CN3806840538_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp   │
├────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ n 斯卡夫塔山中的传统农舍,冰岛瓦特纳冰川国家公园 (© Jarcosa/Getty Images)                              │ https://www.bing.com/th?id=OHR.TurfHouse_ZH-CN3250210711_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp       │
└────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Os 系统

$ al os -h
Usage: cli os [options]

获取系统参数

Options:
  -ip, --ipv4   ipv4信息
  -ip6, --ipv6  ipv6信息
  -h, --help    display help for command
$ al os
┌──────────────────────────────────────────┬────────────┬──────┬──────────────┬─────────────────┬──────────────┬──────────────┬────────────┬──────────────┐
│ cpu                                      │ 处理器架构 │ 核数 │ 空闲内存字节 │ 主机名          │ 操作系统类型 │ 操作系统版本 │ 系统总内存 │ 操作系统名称 │
├──────────────────────────────────────────┼────────────┼──────┼──────────────┼─────────────────┼──────────────┼──────────────┼────────────┼──────────────┤
│ Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz │ x64        │ 4    │ 3.15         │ DESKTOP-EG96IHB │ win32        │ 10.0.18363   │ 7.89       │ Windows_NT   │
└──────────────────────────────────────────┴────────────┴──────┴──────────────┴─────────────────┴──────────────┴──────────────┴────────────┴──────────────┘

-ip|--ipv4

$ al os -ip
┌──────────────────────────────┬──────┬───────────────────┐
│ VirtualBox Host-Only Network │ IPv4 │ 192.168.56.1/24   │
├──────────────────────────────┼──────┼───────────────────┤
│ WLAN                         │ IPv4 │ 192.168.10.121/24 │
├──────────────────────────────┼──────┼───────────────────┤
│ Loopback Pseudo-Interface 1  │ IPv4 │ 127.0.0.1/8       │
└──────────────────────────────┴──────┴───────────────────┘

-ip6|--ipv6

$ al os -ip6
┌──────────────────────────────┬──────┬──────────────────────────────┐
│ VirtualBox Host-Only Network │ IPv6 │ fe80::78a7:8109:6abe:d9ae/64 │
├──────────────────────────────┼──────┼──────────────────────────────┤
│ WLAN                         │ IPv6 │ fe80::d877:6e9:67f0:d6eb/64  │
├──────────────────────────────┼──────┼──────────────────────────────┤
│ Loopback Pseudo-Interface 1  │ IPv6 │ ::1/128                      │
└──────────────────────────────┴──────┴──────────────────────────────┘

Regular 正则

$ al reg
? 正则表达式 中文
/^[\u4e00-\u9fa5]+$/

Byte 字节转换

$ al byte
? from: KB
? to: MB
? byte: 1024
1 MB

Cmd shell 操作

$ al cmd -h
Usage: cli cmd [options]

shell 操作

Options:
  -l, --ls [args]  查询
  -h, --help       display help for command

-l 执行查询

$ al cmd -l npm
查询全局npm包
⠹ C:\Users\gongjie\AppData\Roaming\npm
+-- @alrale/cli@1.0.17
...

Pipe 管道符常用命令

$ al p -h
Usage: cli pipe|p [options]

管道符常用命令 (| xargs [options] <command>)

Options:
  -l, --list   查看所有命令 (| grep [option])
  -t, --table  表格查看所有命令
  -h, --help   display help for command

-t 表格查看

$ al p -t
┌────────┬──────────────────┬───────────┐
│ Option │ Command          │ Details   │
├────────┼──────────────────┼───────────┤
│ npm    │ list -g --dept 0 │ 全局npm包 │
└────────┴──────────────────┴───────────

-l 列表查看

$ al p -l
npm: list -g --dept 0

execute

$ al p npm | xargs npm
C:\Users\gongjie\AppData\Roaming\npm
+-- @alrale/cli@1.0.17
...

Website 常用网站

$ al o -h
常用网站
command:
[al o -t 查看所有]
[al o gitee 打开gitee]

Options:
  -t           查看所有
  -f, --fetch  远端获取最新
  -c, --clear  清空本地用户配置信息
  
$ al open github # open github websit

doc 接口文档转换

$ al doc -h
json文件 格式化接口文档

Options:
  -y, --yapi <file>     格式化yapi
  -s, --swagger <file>  格式化swagger

color 常用颜色Hex表

$ al color

git commit emoji表

$ al git # table
$ al git -l # list
1.0.36

4 years ago

1.0.35

4 years ago

1.0.34

4 years ago

1.0.33

4 years ago

1.0.32

4 years ago

1.0.31

4 years ago

1.0.29

4 years ago

1.0.28

4 years ago

1.0.30

4 years ago

1.0.27

4 years ago

1.0.26

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.9

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago