# File lib/chef/knife.rb, line 130 def self.guess_category(args) category_words = args.select {|arg| arg =~ /^([[:alnum:]]|_)+$/ } matching_category = nil while (!matching_category) && (!category_words.empty?) candidate_category = category_words.join(' ') matching_category = candidate_category if subcommands_by_category.key?(candidate_category) matching_category || category_words.pop end matching_category end