1min 中文文档教程

发布于 5年前 浏览 26 项目主页 更新于 3年前

30s 命令应用

A command-line application for 30 seconds of code snippets(一个基于 30 seconds of code 的命令应用).

NPMbuild statuscoverallsdependabot statussemantic-releaselicense

示例


Features(功能点)

  • Written in JavaScript (ES6)(使用 ES6 编写)
  • View, view by tag and search snippets(查看,按标签查看并搜索代码片段)
  • Show what you find necessary by picking a layout(通过选择布局显示您认为必要的内容)
  • Colorful output or JSON(高亮色彩输出或者输出 JSON 格式)
  • Copy all code to clipboard(拷贝所有的代码到剪切板)
  • Automatically updates with new snippet changes(自动更新新的代码片段)
  • Works on Linux, Mac and Windows(适用于 Linux,Mac 和 Window 系统)

Installation(安装)

Pick one of the following options to install the command-line application:(选择以下选项中的一种来安装命令行应用)

Option 1: NPM / Yarn(选项 1:NPM / Yarn)

npm install -g 30s
yarn add -g 30s

Option 2: Source(选项 2:源码)

$ git clone https://github.com/effiyichengliang/30s-command-line.git
$ cd 30s-command-line/
$ npm install
$ node lib/index.js <command> <query>

Usage(使用)

Commands(命令)

Short versionLong versionDescription(描述)
rrandomView random snippet(随机产看代码片段)
ssearchFuzzy search (RegExp) snippets by id(通过 ID 来模糊搜索(正则表达式)代码片段)
ttagView snippets by tag(通过标签来查看代码片段)
vviewView snippet with id(查看带有 ID 的代码片段)

Options(选项)

Short versionLong versionDescription(描述)
-c--cpCopy snippet code to clipboard(拷贝代码片段到剪切板)
-j--jsonPrint output in JSON format(以 JSON 格式打印输出)
-l--layoutPrint output with specified layout (default: "itced")
-h--helpOutput usage information
Layout
Layout keyDescription
iOutput snippet id
tOutput snippet tags
cOutput snippet code
eOutput snippet examples
dOutput snippet description

Examples

ExampleDescription
30s v headView snippet with id head
30s view headView snippet with id head
30s rView random snippet
30s randomView random snippet
30s t arrayView snippets by tag array
30s tag arrayView snippets by tag array
30s s allFind all snippets with an id that contains all
30s search allFind all snippets with an id that contains all
30s view merge --cpView snippet with id merge and copy its code
30s view merge --jsonView snippet with id merge and output as JSON
30s search all --layout ceFind all snippets with an id that contains all and output code and example

Contributing(贡献)

Bug reports & feature requests(Bug 报告 & 功能需求)

Please use the issue tracker to report bugs or file feature requests(请使用issue tracker来报告 Bug 和提交功能需求).

Developing(开发)

Pull requests are more than welcome. Do the following to start helping out(请使用拉请求的方式,并遵循以下规则来提供您的帮助):

  1. Fork this repository to your own GitHub account and then clone it to your local device(Fork 这个项目到你自己的 GitHub 账号,然后 clone 它到你的本地机器上).
  2. Run npm install in the created directory to install all necessary dependencies(在 clone 下来的项目目录下运行 npm install 来安装必须的依赖包).

Optional steps (可选步骤):

  1. Uninstall 30s if it's already installed(如果你已经装过 30,请先卸载): npm uninstall -g 30s
  2. Link it to the global module directory: npm link(将本项目软链接到你的全局模块目录)

Style guide & conventions(风格指南 & 协议约定)

Try to follow functional programming best practices. Use pure functions and Ramda when possible(尽量遵循函数式编程来练习。尽可能的使用纯函数和 Ramda 表达式).

Write commits following(遵循日志提交书写格式): Angular Commit Message Conventions. This enables us to automatically release new versions together with(保证我们的自动版本更新遵循) semantic-release on fix and feat commit types.

prettier and eslint-config-sqve (a config based on standardjs) enforces our styling and formatting. It runs automatically on pre-commit and is also checked for issues on Travis CI(强制使用 standardjs) 配置 prettiereslint-config-sqve)来保持我们的风格和格式化。我们将在你日志提交时运行自动化检测.

Roadmap(路标)

See the development board for a detailed development roadmap. Below are a short outline of important improvements:

  • Autocomplete with omelette
  • Replace commander with basic yargs and own logic

Thanks

A big thank you to the core team and all the contributers at 30-seconds-of-code for creating an awesome curated collection of snippets.

License

Creative Commons License
CC0 1.0 Universal
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文