itt 0.1.7 → 0.2.0.pre1

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/lib/itt.rb +48 -14
  3. data/lib/version.rb +1 -1
  4. metadata +17 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a8a0e8d4c59d267db4da28b9757ad12fa640fd6c0de4fe0ce7395526b1d3e2f8
4
- data.tar.gz: ab0e0225f2558ec0d131a88364aeadb645213296337cdbd50198ae2408fe44fb
3
+ metadata.gz: b4ab9ea849330465918b93a4f74d8700b434912d6b401540b032afab4bab1712
4
+ data.tar.gz: f7071cd58794082bc43f4ace688dae77199cdb9e08d5d656565082e33e9c0bbe
5
5
  SHA512:
6
- metadata.gz: 312f7b36d69e1b3e5822220cc4fff67fef807edae4258ef022542ab8c4530162228a49419be4c434ffda3efe07fa06972d613113e364c92cef07d72c95e491a7
7
- data.tar.gz: 7785db00bde3f3541d35f7f2bc76e0aaab1f49c5146c4a305cea6b3153bb98ddb553204e2b5f101c693fcfb201bc7c1103d8ddecacd239907599ef3157f88711
6
+ metadata.gz: 378d3c39c370c2e30441c3b5042a6768cdfa4b04eda6d7a5fd49d57b0c9536664fed2aefe74543c6c096da19c284b145de8e2a0578da8f53d11ab90716a0e752
7
+ data.tar.gz: 2b2ec9f7bcb97e2977960dd5a326538ca34ab4261e32e23f71269ab911eafa8f79a9616364532afcaf40515674af61f3f094754809d63610df0eceb5615f0acb
data/lib/itt.rb CHANGED
@@ -1,5 +1,5 @@
1
- require 'version'
2
- require 'rumoji'
1
+ require "version"
2
+ require "rumoji"
3
3
  module ITT
4
4
  # Predefined colors, as close to the default iTerm2 tab colors as possible
5
5
  COLORS = {
@@ -11,18 +11,52 @@ module ITT
11
11
  purple: [140, 121, 149]
12
12
  }
13
13
 
14
+ # ANSI formatting
15
+ module Style
16
+ RESET = "\e[0m"
17
+ BOLD = "\e[1m"
18
+ DIM = "\e[2m"
19
+ # Foreground colors
20
+ RED = "\e[38;2;214;110;107m"
21
+ GREEN = "\e[38;2;183;213;103m"
22
+ BLUE = "\e[38;2;117;165;236m"
23
+ ORANGE = "\e[38;2;223;157;78m"
24
+ YELLOW = "\e[38;2;167;160;96m"
25
+ PURPLE = "\e[38;2;140;121;149m"
26
+ CYAN = "\e[36m"
27
+ WHITE = "\e[37m"
28
+ end
29
+
30
+ def self.styled_colors
31
+ COLORS.keys.map do |c|
32
+ color_code = Style.const_get(c.to_s.upcase)
33
+ "#{color_code}#{c}#{Style::RESET}"
34
+ end.join(Style::DIM + ", " + Style::RESET)
35
+ end
36
+
14
37
  # Help info
15
- HELP = ''
16
- HELP << "Version: #{VERSION}\n\n"
17
- HELP << "Sets the color and/or title of the current iTerm2 tab\n\n"
18
- HELP << "USAGE:\nitt [color] title"
19
- HELP << "\nExamples:\n\n\titt purple web-server\n\titt p web-server"
20
- HELP << "\titt orange rails-console\n"
21
- HELP << "\titt blue :whale: docker\n\n"
22
- HELP << "Clear title and color:\n\n"
23
- HELP << "\titt clear\n\n"
24
- HELP << "Colors: #{COLORS.keys.map(&:to_s).join(', ')}\n\n"
25
- HELP << "Emoji cheat-sheet: http://www.emoji-cheat-sheet.com\n\n"
38
+ HELP = <<~HELP
39
+ #{Style::BOLD}itt#{Style::RESET} #{Style::DIM}v#{VERSION}#{Style::RESET}
40
+ #{Style::DIM}iTerm2 tab color and title utility#{Style::RESET}
41
+
42
+ #{Style::BOLD}USAGE#{Style::RESET}
43
+ itt #{Style::DIM}[color]#{Style::RESET} #{Style::CYAN}<title>#{Style::RESET}
44
+ itt clear
45
+
46
+ #{Style::BOLD}EXAMPLES#{Style::RESET}
47
+ itt #{Style::PURPLE}purple#{Style::RESET} web-server #{Style::DIM}# Set color and title#{Style::RESET}
48
+ itt #{Style::PURPLE}p#{Style::RESET} web-server #{Style::DIM}# Short color name#{Style::RESET}
49
+ itt #{Style::ORANGE}orange#{Style::RESET} rails-console
50
+ itt #{Style::BLUE}blue#{Style::RESET} :whale: docker #{Style::DIM}# Emoji support#{Style::RESET}
51
+ itt #{Style::RED}clear#{Style::RESET} #{Style::DIM}# Reset to default#{Style::RESET}
52
+
53
+ #{Style::BOLD}COLORS#{Style::RESET}
54
+ #{styled_colors}
55
+
56
+ #{Style::DIM}Emoji codes: https://emoji-cheat-sheet.com#{Style::RESET}
57
+ HELP
58
+
59
+ module_function
26
60
 
27
61
  # Escape sequence to set the title
28
62
  def set_title(title)
@@ -31,7 +65,7 @@ module ITT
31
65
 
32
66
  # Escape sequences to set the color
33
67
  def set_color(red, green, blue)
34
- output = ''
68
+ output = ""
35
69
  output << "\e]6;1;bg;red;brightness;#{red}\a"
36
70
  output << "\e]6;1;bg;green;brightness;#{green}\a"
37
71
  output << "\e]6;1;bg;blue;brightness;#{blue}\a"
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ITT
2
- VERSION = '0.1.7'
2
+ VERSION = "0.2.0.pre1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.2.0.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Ladachowski
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-06 00:00:00.000000000 Z
11
+ date: 2026-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rumoji
@@ -24,7 +24,8 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.4'
27
- description: iTerm2 tabs color and title util
27
+ description: Set iTerm2 tab titles and background colors from the command line. Supports
28
+ all default iTerm2 colors and emoji in titles.
28
29
  email: adam@saiden.pl
29
30
  executables:
30
31
  - itt
@@ -37,14 +38,14 @@ files:
37
38
  homepage: https://github.com/aladac/itt
38
39
  licenses:
39
40
  - MIT
40
- metadata: {}
41
- post_install_message: |+
42
- If you are using zsh please add
43
-
44
- export DISABLE_AUTO_TITLE=true
45
-
46
- To .zshrc
47
-
41
+ metadata:
42
+ homepage_uri: https://github.com/aladac/itt
43
+ source_code_uri: https://github.com/aladac/itt
44
+ changelog_uri: https://github.com/aladac/itt/commits/master
45
+ bug_tracker_uri: https://github.com/aladac/itt/issues
46
+ rubygems_mfa_required: 'true'
47
+ post_install_message: "\n\e[1mitt\e[0m installed successfully!\n\n\e[2mIf using zsh,
48
+ add to ~/.zshrc:\e[0m\n export DISABLE_AUTO_TITLE=true\n\n"
48
49
  rdoc_options: []
49
50
  require_paths:
50
51
  - lib
@@ -52,15 +53,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
52
53
  requirements:
53
54
  - - ">="
54
55
  - !ruby/object:Gem::Version
55
- version: 1.9.3
56
+ version: 2.6.0
56
57
  required_rubygems_version: !ruby/object:Gem::Requirement
57
58
  requirements:
58
59
  - - ">="
59
60
  - !ruby/object:Gem::Version
60
61
  version: '0'
61
62
  requirements: []
62
- rubygems_version: 3.0.3.1
63
- signing_key:
63
+ rubygems_version: 3.5.22
64
+ signing_key:
64
65
  specification_version: 4
65
- summary: itt
66
+ summary: iTerm2 tab color and title utility
66
67
  test_files: []