| 
									
										
										
										
											2016-09-24 13:52:43 +02:00
										 |  |  | module Hbc | 
					
						
							|  |  |  |   class CLI | 
					
						
							|  |  |  |     class Cat < Base | 
					
						
							|  |  |  |       def self.run(*args) | 
					
						
							|  |  |  |         cask_tokens = cask_tokens_from(args) | 
					
						
							|  |  |  |         raise CaskUnspecifiedError if cask_tokens.empty? | 
					
						
							|  |  |  |         # only respects the first argument | 
					
						
							| 
									
										
										
										
											2016-10-14 20:03:34 +02:00
										 |  |  |         cask_token = cask_tokens.first.sub(/\.rb$/i, "") | 
					
						
							| 
									
										
										
										
											2016-09-24 13:52:43 +02:00
										 |  |  |         cask_path = Hbc.path(cask_token) | 
					
						
							|  |  |  |         raise CaskUnavailableError, cask_token.to_s unless cask_path.exist? | 
					
						
							|  |  |  |         puts File.open(cask_path, &:read) | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2016-08-18 22:11:42 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-24 13:52:43 +02:00
										 |  |  |       def self.help | 
					
						
							|  |  |  |         "dump raw source of the given Cask to the standard output" | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2016-08-18 22:11:42 +03:00
										 |  |  |   end | 
					
						
							|  |  |  | end |