Class: CommitGpt::CLI
- Inherits:
-
Thor
- Object
- Thor
- CommitGpt::CLI
- Defined in:
- lib/commitgpt/cli.rb
Overview
CommitGpt CLI
Class Method Summary collapse
-
.help(shell, _subcommand = false) ⇒ Object
Custom help message.
Instance Method Summary collapse
Class Method Details
.help(shell, _subcommand = false) ⇒ Object
Custom help message
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/commitgpt/cli.rb', line 38 def self.help(shell, _subcommand = false) shell.say 'Usage:' shell.say ' aicm # Generate AI commit message (Default)' shell.say ' aicm setup # Configure AI provider and settings' shell.say ' aicm help [COMMAND] # Describe available commands' shell.say '' shell.say 'Options:' shell.say ' -m, --models # Interactive model selection' shell.say ' -p, --provider # Switch active provider' shell.say ' -f, --format # Choose commit message format' shell.say ' -d, --detail # Choose commit message detail level' shell.say ' -v, --verbose # Show git diff being sent to AI' shell.say '' # Show current configuration begin require 'commitgpt/config_manager' require 'commitgpt/string' config = CommitGpt::ConfigManager.get_active_provider_config if config require 'commitgpt/version' shell.say "CommitGPT v#{CommitGpt::VERSION}" shell.say "Bin Path: #{File.realpath($PROGRAM_NAME)}".gray shell.say '' format = CommitGpt::ConfigManager.get_commit_format shell.say 'Current Configuration:' shell.say " Provider: #{config['name'].green}" shell.say " Model: #{config['model'].cyan}" shell.say " Format: #{format.capitalize.yellow}" shell.say " Detail: #{CommitGpt::ConfigManager.get_commit_detail.capitalize.yellow}" shell.say " Base URL: #{config['base_url']}" shell.say " Diff Len: #{config['diff_len']}" shell.say " Timeout: #{CommitGpt::ConfigManager.get_model_fetch_timeout}s" shell.say '' end rescue StandardError # Ignore errors during help display if config is missing/invalid end end |
Instance Method Details
#generate ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/commitgpt/cli.rb', line 18 def generate if [:provider] CommitGpt::SetupWizard.new.switch_provider elsif [:models] CommitGpt::SetupWizard.new.change_model elsif [:format] CommitGpt::SetupWizard.new.choose_format elsif [:detail] CommitGpt::SetupWizard.new.choose_detail else CommitGpt::CommitAi.new.aicm(verbose: [:verbose]) end end |
#setup ⇒ Object
33 34 35 |
# File 'lib/commitgpt/cli.rb', line 33 def setup CommitGpt::SetupWizard.new.run end |