gpt_helpr 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 517f6f3290d45ea8b2e9b14e6c77d051ae771948c2f1b37d39ddc27a891d624f
4
- data.tar.gz: ab65c67d108926f07ecd777ec3ddfce14192d1a975c76da18ed59f919ee7095f
3
+ metadata.gz: c814003e6048682f0cbbf4985a6bf7a808c3f9ebc9930802c1a77431f9332d66
4
+ data.tar.gz: b2d2409169926d3e34a65b508b422a11497b865bd342ec9f010d9433d386798e
5
5
  SHA512:
6
- metadata.gz: d04bcfee6aface86e18e757d5e2427ce048d9bf5f06190fd708353de915477598f14f0459a8d53a5a9cebeb80e01b0b0bf0a2b6a549b6ec78b7cade7e9ce7bba
7
- data.tar.gz: 2a4036ccdd1b35bba237c55433c69924b22dc11f6fd28b5e0de4fc98d9f7f97da3759a01f74b653d37f29da693c24b4770d00d7122e36957ab4cc308446cce0b
6
+ metadata.gz: 721f294a118a2c86d3ea80acb3f9b639f575a1a56db1d82dffacc0144e9038fd868f7b126a72a36da139d17dd73030fb87fec81252b3ee65d35e08835b0265f4
7
+ data.tar.gz: a493222c91116d543a2992a0d08b4062d6d488be010c0ffff32df87aaf011bd826720642cf70ccf2092d35368a2e9cb6b44c97a23b37182010752df42b9fcd91
data/lib/gpt_helpr/cli.rb CHANGED
@@ -5,11 +5,10 @@ require 'time'
5
5
 
6
6
  module GptHelpr
7
7
  class CLI
8
-
9
- def self.start(args=[])
8
+ def self.start(args = [])
10
9
  Dir.chdir(Dir.pwd)
11
10
 
12
- puts "GptHelpr #{GptHelpr::VERSION} - To help dig your codebase and cook GPT-XX instructions [current directory #{Dir.pwd}]"
11
+ puts "== 🏴‍☠️ GptHelpr #{GptHelpr::VERSION} == Helping to dig your codebase and cook GPT-XX instructions [Location: #{Dir.pwd}]"
13
12
  line_numbers = args.include?('-ln') || args.include?('--line-numbers')
14
13
 
15
14
  if args.include?('-i') || args.include?('--interactive')
@@ -17,7 +16,7 @@ module GptHelpr
17
16
  else
18
17
 
19
18
  if args.empty?
20
- puts 'Usage: gpt_helpr <file1> <re: instructions> / <file2> <re: instructions> [--f] [--file] [--i] [--interactive] [--ln] [--line-numbers]'
19
+ puts 'Usage: gpt_helpr <file1> <instructions> / <file2> <instructions> [--f] [--file] [--i] [--interactive] [--ln] [--line-numbers]'
21
20
  exit 1
22
21
  end
23
22
 
@@ -48,6 +47,7 @@ module GptHelpr
48
47
  write_to_file(final_output)
49
48
  else
50
49
  puts final_output
50
+ puts '(Output copied to clipboard)'
51
51
  end
52
52
  end
53
53
 
@@ -65,7 +65,7 @@ module GptHelpr
65
65
  end
66
66
 
67
67
  content
68
- rescue => e
68
+ rescue StandardError => e
69
69
  "Error reading file: #{e.message}"
70
70
  end
71
71
 
@@ -76,12 +76,12 @@ module GptHelpr
76
76
 
77
77
  content = process_file(file_path, lines_range, line_numbers)
78
78
 
79
- output += "#### file source `#{file_path}`\n"
79
+ output += "\n==== file source `#{file_path} #{lines_range}`\n"
80
80
  output += "```\n"
81
81
  output += "#{content}\n"
82
82
  output += "```\n\n"
83
83
  output += "#{re_text}\n\n"
84
- output += "#### end of `#{file_path}`\n"
84
+ output += "==== end of `#{file_path}`\n"
85
85
  output += "\n"
86
86
  end
87
87
  output
@@ -96,29 +96,25 @@ module GptHelpr
96
96
  timestamp = Time.now.utc.iso8601
97
97
  filename = "gpt_#{timestamp}.md"
98
98
  File.write(filename, output)
99
- puts "Output written to #{filename}"
99
+ puts "(Output written to #{filename})"
100
100
  end
101
101
 
102
- def self.interactive_mode(line_numbers = false)
102
+ def self.interactive_mode(_line_numbers = false)
103
103
  files = []
104
104
 
105
105
  Readline.completion_append_character = nil
106
- Readline.completion_proc = -> (input) {
107
- Dir[input + '*'].grep(/^#{Regexp.escape(input)}/)
108
- }
106
+ Readline.completion_proc = ->(input) { Dir["#{input}*"].grep(/^#{Regexp.escape(input)}/) }
109
107
 
110
- while true
111
- begin
112
- file_input = Readline.readline('File Path (optional :start:end): ', true)
113
- break if file_input.nil? || file_input.strip.empty?
108
+ loop do
109
+ file_input = Readline.readline('File Path (optional :start:end): ', true)
110
+ break if file_input.nil? || file_input.strip.empty?
114
111
 
115
- file_path, lines_range = file_input.split(':', 2)
116
- re_text = Readline.readline('Instructions: ', true)
112
+ file_path, lines_range = file_input.split(':', 2)
113
+ re_text = Readline.readline('Instructions: ', true)
117
114
 
118
- files << [file_path.strip, re_text.strip, lines_range]
119
- rescue Interrupt
120
- break
121
- end
115
+ files << [file_path.strip, re_text.strip, lines_range]
116
+ rescue Interrupt
117
+ break
122
118
  end
123
119
 
124
120
  files
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GptHelpr
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gpt_helpr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emanuele Tozzato
@@ -24,9 +24,28 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.0.3
27
- description: It is often necessary to provide context and explanations for the code.
28
- Instead of manually copying and formatting code snippets, GPT-Helpr automates the
29
- process, generating well-structured Markdown output.
27
+ description: "== What is GptHelpr?\n\nIt is sometime necessary to provide context
28
+ and explanations for your code. Instead of manually copying and formatting code
29
+ snippets, GPT-Helpr automates the process with an interactive cli, generating a
30
+ well-structured Markdown output, which can be copied to your clipboard or printed
31
+ to file.\n\n=== Example Usage\n\n```\n#note lmk is an alias for gpt_helpr -i -ln\n\n$
32
+ lmk\n== \U0001F3F4‍☠️ GptHelpr 0.2.2 == Helping to dig your codebase and cook GPT-XX
33
+ instructions [current directory /Users/etozzato/WorkSpace/_AINZ/pizzatarians.com]\n\nFile
34
+ Path (optional :start:end): TAB ->\nfavicon.ico hey.md js
35
+ \ random-acts-of-pizza.md\n_config.yml _site
36
+ \ draft fonts\nimages kneading-baking-academy.md
37
+ \ _exe academy\nfavicon.gif hands-in-dough.md
38
+ \ index.md parties-and-events.md\n\nFile Path (optional
39
+ :start:end): hey.md 1:22\nInstructions: can you improve this text? Do you see any
40
+ issues with the template?\nFile Path (optional :start:end):\n\n==== file source
41
+ \ `hey.md`\n\n1: ---\n2: title: Hey, hello!\n3: layout: default\n4: ---\n5:\n6:
42
+ # {{ page.title }}\n7: ----\n8:\n9: <div class=\"row\">\n10: <div class=\"col-md-12\">\n11:
43
+ \ <p class='justin'>\n12: Nice to meet you, I am *Mek*!\n13: </p>\n14:
44
+ \ <p class='listo'>\n15: I am a self-proclaimed pizza guru and I am here
45
+ to teach & learn. Originally from Venice, Italy you can find me in San Diego, CA.\n16:
46
+ \ </p>\n17: <p class='listo'>\n18: In my spare time, I write code @
47
+ PlayStation!\n19: </p>\n20: </div>\n21: </div>\n22:\n\ncan you improve this
48
+ text? Do you see any issues with the template?\n\n==== end of `hey.md`\n```\n"
30
49
  email:
31
50
  - etozzato@gmail.com
32
51
  executables:
@@ -50,6 +69,7 @@ metadata:
50
69
  homepage_uri: https://etozzato.com
51
70
  source_code_uri: https://github.com/etozzato/gpt-helpr
52
71
  changelog_uri: https://github.com/etozzato/gpt-helpr/blob/main/CHANGELOG.md
72
+ rubygems_mfa_required: 'true'
53
73
  post_install_message:
54
74
  rdoc_options: []
55
75
  require_paths:
@@ -68,5 +88,6 @@ requirements: []
68
88
  rubygems_version: 3.5.14
69
89
  signing_key:
70
90
  specification_version: 4
71
- summary: GPT-Helpr is designed to save time and effort when sharing code snippets
91
+ summary: "== \U0001F3F4‍☠️ GptHelpr 0.2.2 == Helping to dig your codebase and cook
92
+ GPT-XX instructions"
72
93
  test_files: []