Coder Social home page Coder Social logo

opencmd's Introduction

Table of Contents

opencmd 是什么

opencmd帮你管理、运行各种零散的脚本的命令行工具

为什么需要opencmd

日常有很多功能单一的脚本需要执行,比如

  • 只在本地开发环境用到的初始化和清理临时文件的脚本
  • 项目手动打包部署到某一台测试机器
  • 有些很少会用到,但是内容很复杂的命令行
  • Makefile里不适合放到git里的命令
  • 一些ugly但是确实快捷的自定义脚本
  • ......

一般在开发环境下,不同的项目有不同的命令管理方式,比如放到Makefile里,package.json 的 scripts 字段等, 但这些命令一般会加上版本控制公开给项目的所有开发者,对上面列举的那临时的、测试用的、不完善的、有用但是用的很少的脚本,很多时候是加到一个 cheat-sheet 文件,需要时复制出来运行一次。

opencmd 试图解决这个问题,基本上可以把它的运行方式描述为:

  1. 在项目根目录创建 ".opencmd/commands/" 目录, 并把上面提到的所有脚本放进去
  2. 在项目的根目录或者任意子目录,用 opencmd list 可以列出所有命令,用 opencmd run [filename] 运行命令

把脚本放到单独的文件内,而不是像 Makefile 或者 package.json 那样集中在一个文件内,主要是因为两个原因:

  1. 放到单独的文件不限制脚本的复杂度, 可以把任意长的脚本管理起来
  2. 方便对脚本分组,对.gitignore来说更友好,从而把用到的脚本都放在项目内而不用管git的问题,比如可以在commands目录建立一个private目录,在.gitignore文件直接忽略掉整个目录。

快速开始

安装

  1. 下载页面下载所需平台的最新版本
  2. 解压并将opencmd文件移至/usr/bin

另外,建议添加以下至shell配置

alias oc="opencmd"
alias ocr="opencmd run"

命令参考

Usage:
  opencmd [command]

Available Commands:
  help        Help about any command
  list        show available commands and path
  run         run a command
  version     show version

Flags:
  -h, --help   help for opencmd

Use "opencmd [command] --help" for more information about a command.

opencmd's People

Contributors

nk avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.