Code Monkey home page Code Monkey logo

commentshell's Introduction

CommentShell

release license intellij

简体中文 | English

CommentShell(CSL)一个可以在注释中运行shell命令的intellij插件。

其可以帮助开发者快速在文件内执行指定命令,而不需要在终端去敲打shell命令, 如:开发golang的grpc服务时,我们需要用protoc工具生成pb.go,传统做法是编写完proto文件后在打开终端输入shell命令去生成pb文件, 但是现在,你可以用CLS去替代传统做法提高你的开发效率,只需要在单行注释中以x:generate开头, 后面跟上你需要执行的shell命令即可,如:我期望通过shell命令打印 hello proto, 你可以通过 //x:generate echo hello proto 这样一行单行注释即可实现

支持的语言

  • .gitignore
  • Antlr(g4)
  • Api(go-zero)
  • Dart
  • Dockerfile
  • Drools
  • Gherkin
  • Gradle
  • Groovy
  • Html
  • Java
  • JavaScript
  • JFlex
  • JSPX
  • Kotlin
  • Lua
  • Markdown
  • Perl
  • PHP
  • Properties
  • Proto
  • Python
  • R
  • React
  • Ruby
  • Rust
  • Scala
  • SQl
  • TypeScript
  • Vue
  • XML
  • YAML

以上语言或者文件已经经过测试,除此外,只要编程语言或者某类型文件支持单行注释语法且指定单行注释类型和语法书写规范理论均可使用(见下文)。

支持的注释类型

  • Java风格单行注释
    //x:generate echo hello java
    
  • Yaml风格单行注释
    #x:generate echo hello yaml
    
  • SQL风格单行注释
    --x:generate echo hello sql
    
  • xml/html风格单行注释
    <!--x:generate echo hello xml-->
    

书写规则

格式

[linePrefix]x:generate [shell] [arg...] [lineSuffix]
  • linePrefix 为单行注释开始标志,仅支持//#--<!--
  • lineSuffix 为单行注释结束标志,仅支持 --> 此为html/xml风格单行注释特有
  • x:generate 为关键字

注意

  • linePrefix与 x:generate 之间不能有任何其他内容

常量

  • %DIR% 代表当前文件的文件目录,如:/foo/bar
  • %FILENAME% 代表当前文件路径,如:/foo/bar/foobar.txt
  • %PERCENT_SIGN% 代表百分号符号本身%
  • "%BASE%" 代表当前文件名称,如:foobar.txt

示例

  • 在Java文件注释中输出 hello java
    //x:generate echo hello java
    
    output:
    hello java
    
  • 在proto文件中生成pb.go
    //x:generate protoc --go_out=plugins=grpc:. %FILENAME%
    
  • 在Java代码中输出 PATH 环境变量值
    //x:generate echo $PATH
    

GIF演示

demo

commentshell's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

commentshell's Issues

最新版Goland无法安装

GoLand 2021.1
Build #GO-211.6693.119, built on April 7, 2021
Licensed to lin tao
Subscription is active until April 18, 2022.
For educational use only.
Runtime version: 11.0.10+9-b1341.35 x86_64
VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o.
macOS 11.2.3
GC: G1 Young Generation, G1 Old Generation
Memory: 750M
Cores: 6
Registry: ide.completion.variant.limit=500, debugger.watches.in.variables=false, ide.tree.collapse.recursively=false, suggest.all.run.configurations.from.context=true
Non-Bundled Plugins: Code MiniMap (2.0.0), cn.olange.rule (1.0.4), com.cn.oddcn.plugin.gobuildergenerator (1.1.1), com.intellij.tasks (211.6693.44), com.kondratevpavel.plugins.goland.gomethodgenerator (1.0), com.paperetto.dash (3.3), io.zhile.research.ide-eval-resetter (2.1.14), leetcode-editor (6.9), net.seesharpsoft.intellij.plugins.file-preview (1.6.4), net.sutanto.go_field_tag (20.04.29), mobi.hsz.idea.gitignore (4.1.0), com.intellij.kubernetes (211.6693.108), org.toml.lang (0.2.145.3797-211), some.awesome (1.14), cn.yiiguxing.plugin.translate (3.1), com.ypwang.plugin.go-linter (1.4.12), idea.plugin.protoeditor (2.3.1)

Plugin 'CommentShell' (version '1.0.1') is not compatible with the current version of the IDE, because it requires build 203.* or older but the current build is GO-211.6693.119

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.