Skip to content

Commit c60a8d1

Browse files
committed
fix #145 - broken CLI required loading active_support/string
1 parent fbb65dc commit c60a8d1

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/oauth/cli.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@
55
require 'oauth/cli/authorize_command'
66
require 'oauth/cli/sign_command'
77
require 'oauth/cli/version_command'
8+
require 'active_support/core_ext/string/inflections'
89

910
module OAuth
1011
class CLI
12+
def self.puts_red(string)
13+
puts "\033[0;91m#{string}\033[0m"
14+
end
15+
1116
ALIASES = {
1217
'h' => 'help',
1318
'v' => 'version',
@@ -43,6 +48,7 @@ def parse_command(command)
4348
when *ALIASES.values
4449
command
4550
else
51+
OAuth::CLI.puts_red "Command '#{command}' not found"
4652
'help'
4753
end
4854
end

lib/oauth/cli/base_command.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def run
1212
if missing.empty?
1313
_run
1414
else
15-
# puts "Options missing to OAuth CLI: #{options}"
15+
show_missing(missing)
1616
puts option_parser.help
1717
end
1818
end
@@ -25,6 +25,11 @@ def required_options
2525

2626
attr_reader :options
2727

28+
def show_missing(array)
29+
array = array.map { |s| "--#{s}" }.join(' ')
30+
OAuth::CLI.puts_red "Options missing to OAuth CLI: #{array}"
31+
end
32+
2833
def xmpp?
2934
options[:xmpp]
3035
end

0 commit comments

Comments
 (0)