美文网首页敲代码
丢弃鼠标之路(1)pbcopy和pbpaste

丢弃鼠标之路(1)pbcopy和pbpaste

作者: AlbertMihawk | 来源:发表于2019-05-15 16:49 被阅读0次

    之前都是写Evernote,今天开始写第一篇博客

    追求全键盘操作的程序员

    Mac系统下

    把命令行的输出存到剪切板

    pwd | pbcopy

    pbcopy pbpaste的介绍  man pbcopy 

    NAME

          pbcopy, pbpaste - provide copying and pasting to the pasteboard (the Clipboadrd) from command line

    通过命令行,拷贝到剪切板,或者从剪切板拷贝出来的两个命令,pbcopy和pbpaste

    SYNOPSIS

          pbcopy [-help] [-pboard {general | ruler | find | font}]

          pbpaste [-help] [-pboard {general | ruler | find | font}] [-Prefer {txt | rtf | ps}]

    DESCRIPTION

          pbcopy takes the standard input and places it in the specified pasteboard. If  no  paste-

          board  is specified, the general pasteboard will be used by default.  The input is placed

          in the pasteboard as plain text data unless it begins with  the  Encapsulated  PostScript

          (EPS)  file  header or the Rich Text Format (RTF) file header, in which case it is placed

          in the pasteboard as one of those data types.

          pbpaste removes the data from the pasteboard and writes it to the  standard  output.  It

          normally  looks  first for plain text data in the pasteboard and writes that to the stan-

          dard output; if no plain text data is in the pasteboard it looks for  Encapsulated  Post-

          Script;  if  no EPS is present it looks for Rich Text.  If none of those types is present

          in the pasteboard, pbpaste produces no output.

          * Encoding:

          pbcopy and pbpaste use locale environment variables to determine the encoding to be  used

          for input and output.  For example, absent other locale settings, setting the environment

          variable LANG=en_US.UTF-8 will cause pbcopy and pbpaste to use UTF-8 for input  and  out-

          put.  If  an encoding cannot be determined from the locale, the standard C encoding will

          be used.  Use of UTF-8 is recommended.  Note that by  default  the  Terminal  application

          uses  the  UTF-8 encoding and automatically sets the appropriate locale environment vari-

          able.

    OPTIONS

          -pboard {general | ruler | find | font}

                  specifies which pasteboard to copy to or paste from.  If no pasteboard  is  given,

                  the general pasteboard will be used by default.

          -Prefer {txt | rtf | ps}

                  tells  pbpaste  what  type of data to look for in the pasteboard first.  As stated

                  above, pbpaste normally looks first for plain text data;  however,  by  specifying

                  -Prefer ps you can tell pbpaste to look first for Encapsulated PostScript.  If you

                  specify -Prefer rtf, pbpaste looks first for  Rich  Text  format.  In  any  case,

                  pbpaste  looks  for  the other formats if the preferred one is not found.  The txt

                  option replaces the deprecated  ascii  option,  which  continues  to  function  as

                  before.  Both indicate a preference for plain text.

    SEE ALSO

          ADC Reference Library:

          Cocoa > Interapplication Communication > Copying and Pasting

          Carbon > Interapplication Communication > Pasteboard Manager Programming Guide

          Carbon > Interapplication Communication > Pasteboard Manager Reference

    BUGS

          There is no way to tell pbpaste to get only a specified data type.

    相关文章

      网友评论

        本文标题:丢弃鼠标之路(1)pbcopy和pbpaste

        本文链接:https://www.haomeiwen.com/subject/yhcmaqtx.html