atom-shell-commands icon indicating copy to clipboard operation
atom-shell-commands copied to clipboard

use unicode escapes in config.cson

Open yucer opened this issue 8 years ago • 1 comments

Thanks a lot for this plug-in. It saves a lot work, avoiding the need of making new plug-ins for every external command integration.

I am trying to integrate the comand for this solution: http://stackoverflow.com/a/9395552/469294

More or less:

grep --color='auto' -P -n "[\x80-\xFF]" {FileName}

so I did try:

  "atom-shell-commands":
    commands: [
      {
        name: "grep_unicode"
        command: "grep"
        arguments: [
          "--color='auto'"
          "-P"
          "-n"
          "\"[\x80-\xFF]\""
          "{FileName}"
        ]
        options:
          cwd: "{FileDir}"
          keymap: "cmd-u"
      }
    ] 

but it doesn't work:

grep","--color='auto'","-P","-n","\"[€-ÿ]\"","myFile.java"]
Usage: grep [OPTION]... PATTERN [FILE]...
Search for PATTERN in each FILE or standard input.
.....

How am I supposed to specify the escape sequence for those unicode characters ?

yucer avatar Sep 27 '16 07:09 yucer

Did you try escaping the backslashes? It looks like the command did what it was supposed to. In CSON, \x80 is replaced with in the string content, so write \\x80, and the string content will end up as \x80.

dqsully avatar Oct 29 '16 23:10 dqsully