terminal_link 1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/terminal_link.rb +23 -0
- metadata +47 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2202053ad91f20f9431e7fb38d7600365beb58d7c155f5fba02999827d325a97
|
4
|
+
data.tar.gz: e99ad8679551d34dab655f3c575b286a15b001943ff442cdfc46095e86535005
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 78d9f75135b4da9fde478c49e5b949f38e78288e4ac0cbcd05fe0f9da65dd65528a4e39dd2e6f2b959289312e9f3e260bec173aaa96ffc468551acc48532510f
|
7
|
+
data.tar.gz: 6ef9cbeba90a76c42ffdae4e134d2d18a4e635382bad8cfedffebbc5217721407048c82552d088690de49213b9e3631840985ba0190983bec23bc7b0ea2c9255
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module TerminalLink
|
2
|
+
class Link
|
3
|
+
attr_accessor :text, :url
|
4
|
+
|
5
|
+
def initialize(url=nil, text=nil)
|
6
|
+
@text = text
|
7
|
+
@url = url
|
8
|
+
end
|
9
|
+
|
10
|
+
def print
|
11
|
+
# template = "echo -e '\e]8;;http://example.com\e\\This is a link\e]8;;\e\\'"
|
12
|
+
default_link = "https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda"
|
13
|
+
if url && !text
|
14
|
+
system("echo", "\e]8;;#{@url}\e\\#{@url}\e]8;;\e\\")
|
15
|
+
elsif url && text
|
16
|
+
system("echo", "\e]8;;#{@url}\e\\#{@text}\e]8;;\e\\")
|
17
|
+
elsif !url && !text
|
18
|
+
system("echo", "\e]8;;#{default_link}\e\\Hyperlinks in terminal emulators\e]8;;\e\\")
|
19
|
+
#`echo -e '\e]8;;#{default_link}}\e\\"Hyperlinks in terminal emulators\e]8;;\e\\'`
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: terminal_link
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '1.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Bojemski
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-01-24 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: 'This gem is for printing hyperlinks in supported terminal emulators.
|
14
|
+
It is a simple wrapper that abstracts the ANSI characters usually required to achieve
|
15
|
+
this, which are annoying to type out. Check out the gist that inspired this gem
|
16
|
+
at: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda'
|
17
|
+
email: chris.bojemski@gmail.com
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- lib/terminal_link.rb
|
23
|
+
homepage: https://github.com/astrosquid/terminal_links
|
24
|
+
licenses:
|
25
|
+
- MIT
|
26
|
+
metadata: {}
|
27
|
+
post_install_message:
|
28
|
+
rdoc_options: []
|
29
|
+
require_paths:
|
30
|
+
- lib
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
requirements: []
|
42
|
+
rubyforge_project:
|
43
|
+
rubygems_version: 2.7.6
|
44
|
+
signing_key:
|
45
|
+
specification_version: 4
|
46
|
+
summary: Print hyperlinks in supported terminal emulators
|
47
|
+
test_files: []
|