This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-eyes.git


The following commit(s) were added to refs/heads/main by this push:
     new 6d65714  feature: support .rst files and allow fixing header of a 
single file (#25)
6d65714 is described below

commit 6d6571432d5524368f0d302e2ca592d2cd019e6b
Author: Zhenxu Ke <[email protected]>
AuthorDate: Tue Mar 23 13:40:03 2021 +0800

    feature: support .rst files and allow fixing header of a single file (#25)
---
 assets/languages.yaml  |  1 +
 assets/styles.yaml     |  5 +++++
 commands/header_fix.go | 11 ++++++++---
 pkg/license/norm.go    |  1 +
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/assets/languages.yaml b/assets/languages.yaml
index 8099dce..505e95f 100644
--- a/assets/languages.yaml
+++ b/assets/languages.yaml
@@ -6660,6 +6660,7 @@ reStructuredText:
   codemirror_mode: rst
   codemirror_mime_type: text/x-rst
   language_id: 419
+  comment_style_id: DoubleDot
 sed:
   type: programming
   color: "#64b970"
diff --git a/assets/styles.yaml b/assets/styles.yaml
index a79eb6c..08e3fed 100644
--- a/assets/styles.yaml
+++ b/assets/styles.yaml
@@ -64,3 +64,8 @@
   start: ';'
   middle: ';'
   end: ';'
+
+- id: DoubleDot
+  start: '..'
+  middle: '..'
+  end: '..'
diff --git a/commands/header_fix.go b/commands/header_fix.go
index a022636..f437c02 100644
--- a/commands/header_fix.go
+++ b/commands/header_fix.go
@@ -34,13 +34,18 @@ var FixCommand = &cobra.Command{
        Long:    "fix command walks the specified paths recursively and fix the 
license header if the specified files don't have the license header.",
        RunE: func(cmd *cobra.Command, args []string) error {
                var result header.Result
+               var errors []string
+               var files []string
 
-               if err := header.Check(&Config.Header, &result); err != nil {
+               if len(args) > 0 {
+                       files = args
+               } else if err := header.Check(&Config.Header, &result); err != 
nil {
                        return err
+               } else {
+                       files = result.Failure
                }
 
-               var errors []string
-               for _, file := range result.Failure {
+               for _, file := range files {
                        if err := header.Fix(file, &Config.Header, &result); 
err != nil {
                                errors = append(errors, err.Error())
                        }
diff --git a/pkg/license/norm.go b/pkg/license/norm.go
index cc21552..f18daa1 100644
--- a/pkg/license/norm.go
+++ b/pkg/license/norm.go
@@ -60,6 +60,7 @@ var (
                regexp.MustCompile(`(?m)^\s*-}+`), // -}
 
                regexp.MustCompile(`(?m)^\s*::`),     // ::
+               regexp.MustCompile(`(?m)^\s*\.\.`),   // ..
                regexp.MustCompile(`(?mi)^\s*@?REM`), // @REM
        }
 

Reply via email to