Skip to content
This repository has been archived by the owner on Mar 30, 2020. It is now read-only.

chalkpe/welcomes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

welcomes CircleCI npm version npm downloads JavaScript Style Guide

Welcome message for shells

Main screenshot

Installation

$ npm install -g welcomes

Usage

Add welcomes --config config.json or welcomes time hangang custom-a custom-b --configs to your run commands file (.bashrc, .bash_profile or .zshrc etc.)

  • Pre-installed plugins: time, hangang, dimibob
  • custom-a is short for welcomes-plugin-custom-a npm package

Configuration

Basic

Key Description Default
dev
-> boolean
false일 경우 에러 메세지가 출력되지 않습니다. false
verbose
-> boolean
true일 경우 현재 설정이 출력됩니다. false
timeout
-> number
요청 타임아웃, 밀리초 단위 (axios 문서 참고) 0
encoding
-> string
인코딩 (axios 문서 참고) 'utf-8'

time plugin

Key Description Default
locale
-> string
출력할 시간의 로케일 (moment 문서 참고) null
format
-> string
출력할 시간의 날짜 포맷 (moment 문서 참고) 'HH:mm:ss'
style
-> string
출력할 텍스트의 스타일 (chalk 문서 참고) null
color
-> string
출력할 텍스트의 배경색, bg 제외. (chalk 문서 참고) 'white'
fgColor
-> string
출력할 텍스트의 전경색 (chalk 문서 참고) 'black'

dimibob plugin

Key Description Default
ignoreSnack
-> boolean
true일 경우 21시 40분 이전에도 간식 대신 다음 아침 메뉴를 출력합니다. false
onlyToday
-> boolean
true일 경우 21시 40분부터 자정까지는 아무 것도 출력하지 않습니다.
false일 경우 21시 40분부터 익일 8시 45분까지 다음 아침 메뉴를 출력합니다.
false
cmd
-> string
출력할 명령어 이름 'dimibob'
cmdFormat
-> string
출력할 명령어 인자의 날짜 포맷 (moment 문서 참고) 'dimibob'
likes
-> string
좋아하는 급식 리스트 (예시) 파일의 경로
null이 아닐 경우 해당되는 메뉴의 텍스트가 강조됨.
null
likesColor
-> string
likesnull이 아닐 경우에만 필요
좋아하는 메뉴 텍스트의 강조 스타일 (chalk 문서 참고).
'blue'
server
-> string
디미고 급식 API의 주소.
URL 파리미터 d로 날짜를 지정할 수 있어야 함.
여기
paramFormat
-> string
URL 파리미터 d의 날짜 포맷 (moment 문서 참고) 'YYYYMMDD'

hangang plugin

Key Description Default
icon
-> string
온도 좌측에 표시될 이모지 '🌡'
style
-> string
출력할 텍스트의 스타일 (chalk 문서 참고) null
fgColor
-> string
출력할 텍스트의 전경색 (chalk 문서 참고) 'black'
server
-> string
한강 온도 API의 주소.
JSON으로 응답해야 하며, temp 필드가 현재 온도 값이어야 함.
여기

Via CLI argument

$ welcomes time dimibob hangang \
  --dev --verbose --timeout 5000 \
  \
  --time:locale ko --time:format LLLL \
  --time:color yellow --time:fgColor magenta --time:style underline \
  \
  --dimibob:ignoreSnack \
  --dimibob:cmd bob --dimibob:cmdFormat L \
  --dimibob:paramFormat YYYYMMDD \
  --dimibob:server "http://dimigo.in/pages/dimibob_getdata.php" \
  --dimibob:likes ./favorites.txt --dimibob:likesColor yellow_underline_bold \
  \
  --hangang:icon='' \
  --hangang:server "http://hangang.dkserver.wo.tc" \
  --hangang:style underline --hangang:fgColor red_bold

Via config file

$ cat welcomes.json
{
  "_": [
    "time",
    "dimibob",
    "hangang"
  ],

  "dev": true,
  "verbose": true,
  "timeout": 5000,

  "time": {
    "color": "yellow",
    "fgColor": "magenta",
    "style": "underline",

    "locale": "ko",
    "format": "LLLL"
  },

  "dimibob": {
    "cmd": "bob",
    "cmdFormat": "L",

    "onlyToday": false,
    "ignoreSnack": true,

    "likes": "./favorites.txt",
    "likesColor": "yellow_underline_bold",

    "paramFormat": "YYYYMMDD",
    "server": "http://dimigo.in/pages/dimibob_getdata.php"
  },

  "hangang": {
    "icon": "",
    "style": "underline",
    "fgColor": "red_bold",

    "server": "http://hangang.dkserver.wo.tc"
  }
}

$ welcomes --config welcomes.json

Output

Usage screenshot

License

MIT License