copy_to_clipboard 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -0
  3. data/bin/copy_to_clipboard +18 -0
  4. metadata +7 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47f2ab09ab26d1e89c55cd44480e2826dfdd84af
4
- data.tar.gz: 4532feb4e7fa11b7161b0b90725a5f1c825ffa4d
3
+ metadata.gz: b9a05ba8831728c43410edbd421cd53c75c43142
4
+ data.tar.gz: 997c7dffb75e85648ff13657d44c4a9a4ea05c37
5
5
  SHA512:
6
- metadata.gz: 99a930b5f5e3527ac64523c01afc9a436c44d23f2ff36d6e987701b73f50b34a7fef80a2574570ac59489de6c9a6e6f3bc37ab5860880106f53d79a31d2f2bb1
7
- data.tar.gz: 363d097be53c3cedc5b425ac7b7721dd1beb65c958be3eb06a3ce472ad3c8ec9d07542e64a2615ddd73e611b4b322275f9ab8ac676436ce3b6b98e7f417cde52
6
+ metadata.gz: 6a27bafdea9ebf9abc9a66e451005668c72bb74b44422035faea23531bc5cf943cd622b1158829aaaa860e31bd26b5975c9d4fc25de215fe964918ba96e889c9
7
+ data.tar.gz: 8648e1a87b90395296467d537966f72257852ff3bd7e6e3a0dade29e2fb6d40fa5b6bd867cf090f68cd7f2a515ac80f6c645d084c20f73326bcfb8f27408b08a
@@ -0,0 +1,16 @@
1
+ # copy_to_clipboard
2
+ A command-line program to copy the contents of any file to the clipboard
3
+
4
+ ## Installation
5
+ To install `copy_to_clipboard`, simply run:
6
+
7
+ ```shell
8
+ gem install copy_to_clipboard
9
+ ```
10
+
11
+ ## How does it work?
12
+ You just need to run the `copy_to_clipboard` command in your terminal passing the file you would like to copy the content to the clipboard, such as the bellow example, and the magic happens =P
13
+
14
+ ```shell
15
+ copy_to_clipboard my_file.txt
16
+ ```
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ def colorize(text, color_code)
4
+ "\e[#{color_code}m#{text}\e[0m"
5
+ end
6
+
7
+ def red(text); colorize(text, 31); end
8
+ def green(text); colorize(text, 32); end
9
+
10
+ file_path = ARGV[0]
11
+
12
+ abort(red('You should pass a file as parameter!')) if ARGV.empty?
13
+ abort(red("File doesn't exist!")) unless File.exist?(file_path)
14
+
15
+ file = File.open(file_path, 'rb')
16
+ IO.popen('pbcopy', 'w') { |pipe| pipe.puts file.read }
17
+
18
+ puts green('Content copied! :)')
metadata CHANGED
@@ -1,21 +1,24 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: copy_to_clipboard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - EvandroLG
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-03 00:00:00.000000000 Z
11
+ date: 2016-05-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A command-line program to copy the contents of any file to the clipboard
14
14
  email: evandrolgoncalves@gmail.com
15
- executables: []
15
+ executables:
16
+ - copy_to_clipboard
16
17
  extensions: []
17
18
  extra_rdoc_files: []
18
- files: []
19
+ files:
20
+ - README.md
21
+ - bin/copy_to_clipboard
19
22
  homepage: https://github.com/EvandroLG/copy_to_clipboard
20
23
  licenses:
21
24
  - MIT