Last active
July 19, 2017 13:15
-
-
Save magicdawn/159a475d94f329d890cb0f8ae28fb52d to your computer and use it in GitHub Desktop.
yargs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const i = yargs | |
.usage('$0 -u <url> [options]') | |
.option('url', { | |
alias: 'u', | |
describe: '专辑/歌单 url', | |
required: true, | |
type: 'string', | |
}) | |
.option('concurrency', { | |
alias: 'c', | |
describe: '设置同时下载数量', | |
default: 5, | |
type: 'number', | |
}) | |
.option('format', { | |
alias: 'f', | |
describe: '设置文件格式', | |
default: ':name/:singer - :songName.:ext', | |
}) | |
.choices('quality', [128, 192, 320]) | |
.option('quality', { | |
alias: 'q', | |
describe: '设置音质', | |
default: 320, | |
}) | |
.coerce('quality', num => num * 1000) | |
.option('max-times', { | |
describe: '设置下载重试次数', | |
default: 5, | |
type: 'number', | |
}) | |
.option('timeout', { | |
describe: '设置下载超时(分)', | |
default: 3, | |
type: 'number', | |
}) | |
.coerce('timeout', num => num * 60 * 1000) // to ms | |
.example( | |
'10首同时下载', | |
'yun -c 10 -u http://music.163.com/#/playlist?id=12583200' | |
) | |
.example( | |
`下载格式为 '歌手 - 歌名'`, | |
`yun -f ':singer - :songName.:ext' -u http://music.163.com/#/playlist?id=12583200` | |
) | |
.epilog('Homepage: http://github.com/magicdawn/yun-playlist-downloader') | |
.version(pkgVersion) | |
.help(true) | |
const argv = i.argv | |
console.log(argv) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/magicdawn/yun-playlist-downloader