├── Gemfile ├── sample.txt ├── ftc-0.0.1.gem ├── install.sh ├── README.md ├── ftc.gemspec ├── ftc.rb ├── lib └── ftc.rb ├── LICENSE └── .gitignore /Gemfile: -------------------------------------------------------------------------------- 1 | gem 'clipboard' 2 | -------------------------------------------------------------------------------- /sample.txt: -------------------------------------------------------------------------------- 1 | this is sample file. 2 | copy it! 3 | -------------------------------------------------------------------------------- /ftc-0.0.1.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hahwul/ftc/master/ftc-0.0.1.gem -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | echo 'Install gem' 2 | gem install clipboard 3 | MYPWD=`pwd` 4 | echo '#/usr/bin/ruby 5 | ruby '$MYPWD'/ftc.rb $*' > /usr/bin/ftc 6 | echo 'Set perm' 7 | chmod 755 /usr/bin/ftc 8 | 9 | 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ftc 2 | simple copy to file to clipboardf 3 | 4 | 5 | ## Install 6 | `#> git clone https://github.com/hahwul/ftc`
7 | `#> cd ftc`
8 | `#> ./install.sh`
9 | 10 | ## Usage 11 | `#> ftc sample.txt`
12 | `#> ruby ftc.rb sample.txt`
13 | 14 | 15 | -------------------------------------------------------------------------------- /ftc.gemspec: -------------------------------------------------------------------------------- 1 | Gem::Specification.new do |s| 2 | s.name = 'ftc' 3 | s.version = '0.0.1' 4 | s.date = '2018-04-28' 5 | s.summary = "file to clipboard" 6 | s.description = "File to Clipboard gem" 7 | s.authors = ["hahwul"] 8 | s.email = 'hahwul@gmail.com' 9 | s.files = ["lib/ftc.rb"] 10 | s.homepage = 11 | 'https://www.hahwul.com' 12 | s.license = 'MIT' 13 | end 14 | -------------------------------------------------------------------------------- /ftc.rb: -------------------------------------------------------------------------------- 1 | require 'clipboard' 2 | 3 | def read_file(file_name) 4 | file = File.open(file_name, 'r') 5 | data = file.read 6 | file.close 7 | data 8 | end 9 | 10 | def usage 11 | puts 'Usage:: ftc.rb [file]' 12 | end 13 | 14 | # [TODO] Argument parsing? 15 | # -h, --help, -v, --version? 16 | 17 | argument = ARGV 18 | if argument.empty? 19 | usage 20 | exit 21 | end 22 | 23 | # [TODO] Add multi argument and copy (multi copy) 24 | 25 | fname = argument.pop 26 | data = read_file(fname) 27 | 28 | Clipboard.copy(data) 29 | 30 | puts '[+] Success copy ' + data.length.to_s + ' length data to clipboard' 31 | -------------------------------------------------------------------------------- /lib/ftc.rb: -------------------------------------------------------------------------------- 1 | require 'clipboard' 2 | 3 | def read_file(file_name) 4 | file = File.open(file_name, 'r') 5 | data = file.read 6 | file.close 7 | data 8 | end 9 | 10 | def usage 11 | puts 'Usage:: ftc.rb [file]' 12 | end 13 | 14 | # [TODO] Argument parsing? 15 | # -h, --help, -v, --version? 16 | 17 | argument = ARGV 18 | if argument.empty? 19 | usage 20 | exit 21 | end 22 | 23 | # [TODO] Add multi argument and copy (multi copy) 24 | 25 | fname = argument.pop 26 | data = read_file(fname) 27 | 28 | Clipboard.copy(data) 29 | 30 | puts '[+] Success copy ' + data.length.to_s + ' length data to clipboard' 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 하훌 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | *.rbc 3 | /.config 4 | /coverage/ 5 | /InstalledFiles 6 | /pkg/ 7 | /spec/reports/ 8 | /spec/examples.txt 9 | /test/tmp/ 10 | /test/version_tmp/ 11 | /tmp/ 12 | 13 | # Used by dotenv library to load environment variables. 14 | # .env 15 | 16 | ## Specific to RubyMotion: 17 | .dat* 18 | .repl_history 19 | build/ 20 | *.bridgesupport 21 | build-iPhoneOS/ 22 | build-iPhoneSimulator/ 23 | 24 | ## Specific to RubyMotion (use of CocoaPods): 25 | # 26 | # We recommend against adding the Pods directory to your .gitignore. However 27 | # you should judge for yourself, the pros and cons are mentioned at: 28 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 29 | # 30 | # vendor/Pods/ 31 | 32 | ## Documentation cache and generated files: 33 | /.yardoc/ 34 | /_yardoc/ 35 | /doc/ 36 | /rdoc/ 37 | 38 | ## Environment normalization: 39 | /.bundle/ 40 | /vendor/bundle 41 | /lib/bundler/man/ 42 | 43 | # for a library or gem, you might want to ignore these files since the code is 44 | # intended to run in multiple environments; otherwise, check them in: 45 | # Gemfile.lock 46 | # .ruby-version 47 | # .ruby-gemset 48 | 49 | # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: 50 | .rvmrc 51 | --------------------------------------------------------------------------------