commandc 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.
- checksums.yaml +4 -4
- data/bin/commandc +2 -0
- data/commandc.gemspec +1 -0
- data/lib/commandc/cli.rb +39 -0
- data/lib/commandc/text.rb +27 -0
- data/lib/commandc/version.rb +2 -1
- data/lib/commandc.rb +3 -5
- data/spec/commandc_spec.rb +0 -4
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f09cbc441f107c34987a2be820bc6e6f3fa5f8e0
|
4
|
+
data.tar.gz: 494694cf40cea5dbd52a37016d19e8422fae7bd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7910f7450759b7904b162b9697d967ec30990e4c4a3f0e2d0c0b7ae4203a2b8f2a7fa6c765d784a754bf154f96adc65a036ca8040363f0b92bfe85f63c55fc5c
|
7
|
+
data.tar.gz: d9b61344f87d222d2327d5591d38bdc0c684e67b58629f118bb6d0d963000742de138b755e41bdfec158245487cfcef3af8caee6f5c29996552d776a70c2073e
|
data/bin/commandc
CHANGED
data/commandc.gemspec
CHANGED
data/lib/commandc/cli.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'commandc/text'
|
3
|
+
|
4
|
+
# @author "Brandon Pittman"
|
5
|
+
module Commandc
|
6
|
+
# @author "Brandon Pittman"
|
7
|
+
# Inherits from Thor in order to create CLI
|
8
|
+
class Cli < Thor
|
9
|
+
desc 'copy --text TEXT --to DEVICE [--open]',
|
10
|
+
'copy TEXT to DEVICE'
|
11
|
+
# @param text [String] the text to copy
|
12
|
+
# @option device [String] the device to copy the text to
|
13
|
+
# @example commandc copy
|
14
|
+
# commandc copy --text "This is some text" --to iPhone --open
|
15
|
+
# commandc copy --to iPhone --open
|
16
|
+
option :to,
|
17
|
+
type: :string,
|
18
|
+
required: true,
|
19
|
+
banner: 'Device to copy text to'
|
20
|
+
option :text,
|
21
|
+
type: :string,
|
22
|
+
default: `pbpaste`,
|
23
|
+
required: false,
|
24
|
+
banner: 'Text to copy (defaults to system clipboard)'
|
25
|
+
option :open,
|
26
|
+
type: :boolean,
|
27
|
+
required: false,
|
28
|
+
default: false,
|
29
|
+
banner: 'Open copied URL on destination device (if a Mac)'
|
30
|
+
def copy
|
31
|
+
output = Commandc::Text.new(
|
32
|
+
options[:text],
|
33
|
+
options[:to],
|
34
|
+
options[:open]
|
35
|
+
)
|
36
|
+
output.copy
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
# @since since 0.0.1
|
4
|
+
module Commandc
|
5
|
+
# @since since 0.0.1
|
6
|
+
class Text
|
7
|
+
attr_accessor :text, :device, :open
|
8
|
+
|
9
|
+
def initialize(text, device, open)
|
10
|
+
@text = text
|
11
|
+
@device = escape_device_name(device)
|
12
|
+
@open = open
|
13
|
+
end
|
14
|
+
|
15
|
+
def copy
|
16
|
+
if open
|
17
|
+
`open "command-c://x-callback-url/copyText?text=#{text}&deviceName=#{device}"`
|
18
|
+
else
|
19
|
+
`open "command-c://x-callback-url/copyAndOpenURL?url=#{text}&deviceName=#{device}"`
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def escape_device_name(device_name)
|
24
|
+
URI.escape(device_name)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/commandc/version.rb
CHANGED
data/lib/commandc.rb
CHANGED
data/spec/commandc_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commandc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- brandonpittman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: thor
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: A CLI for Command-C on OS X.
|
56
70
|
email:
|
57
71
|
- brandonpittman@gmail.com
|
@@ -69,6 +83,8 @@ files:
|
|
69
83
|
- bin/commandc
|
70
84
|
- commandc.gemspec
|
71
85
|
- lib/commandc.rb
|
86
|
+
- lib/commandc/cli.rb
|
87
|
+
- lib/commandc/text.rb
|
72
88
|
- lib/commandc/version.rb
|
73
89
|
- spec/commandc_spec.rb
|
74
90
|
- spec/spec_helper.rb
|