Class: NitPicker::CLI
- Inherits:
-
Object
- Object
- NitPicker::CLI
- Defined in:
- lib/nitpicker.rb
Constant Summary collapse
- CONFIG_DIR =
File.('~/.config/nitpicker')
- PROMPT_FILE =
File.join(CONFIG_DIR, 'prompt')
- REPO_PROMPT_FILE =
'.nitpicker_prompt'
Instance Method Summary collapse
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
- #parse_options ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize ⇒ CLI
Returns a new instance of CLI.
14 15 16 17 |
# File 'lib/nitpicker.rb', line 14 def initialize @options = {} setup_config_dir end |
Instance Method Details
#parse_options ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/nitpicker.rb', line 19 def require 'optparse' OptionParser.new do |opts| opts. = 'Usage: nitpicker [options]' opts.version = VERSION opts.on('-h', '--help', 'Show this help message') do puts opts exit end end.parse! end |
#run ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/nitpicker.rb', line 33 def run # Get git diff of staged changes diff = `git diff --staged` if diff.empty? puts "No changes staged for review." exit 1 end # Get AI-generated code review review = generate_code_review(diff) # Display the review puts review end |