| 
									
										
										
										
											2020-11-25 17:03:23 +01:00
										 |  |  | # typed: true | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 18:25:08 +09:00
										 |  |  | require "cli/parser" | 
					
						
							| 
									
										
										
										
											2018-11-10 22:36:30 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 22:41:47 -05:00
										 |  |  | module Homebrew | 
					
						
							| 
									
										
										
										
											2016-09-26 01:44:51 +02:00
										 |  |  |   module_function | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-20 12:03:48 +02:00
										 |  |  |   sig { returns(CLI::Parser) } | 
					
						
							| 
									
										
										
										
											2018-11-10 22:36:30 +05:30
										 |  |  |   def tap_args | 
					
						
							|  |  |  |     Homebrew::CLI::Parser.new do | 
					
						
							| 
									
										
										
										
											2021-01-15 15:04:02 -05:00
										 |  |  |       usage_banner "`tap` [<options>] [<user>`/`<repo>] [<URL>]" | 
					
						
							|  |  |  |       description <<~EOS | 
					
						
							| 
									
										
										
										
											2018-11-10 22:36:30 +05:30
										 |  |  |         Tap a formula repository. | 
					
						
							| 
									
										
										
										
											2019-08-20 00:04:14 -04:00
										 |  |  |         If no arguments are provided, list all installed taps. | 
					
						
							| 
									
										
										
										
											2018-11-10 22:36:30 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-06 14:22:24 -04:00
										 |  |  |         With <URL> unspecified, tap a formula repository from GitHub using HTTPS. | 
					
						
							| 
									
										
										
										
											2018-11-10 22:36:30 +05:30
										 |  |  |         Since so many taps are hosted on GitHub, this command is a shortcut for | 
					
						
							|  |  |  |         `brew tap` <user>`/`<repo> `https://github.com/`<user>`/homebrew-`<repo>. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-06 14:22:24 -04:00
										 |  |  |         With <URL> specified, tap a formula repository from anywhere, using | 
					
						
							| 
									
										
										
										
											2019-08-06 14:20:27 -04:00
										 |  |  |         any transport protocol that `git`(1) handles. The one-argument form of `tap` | 
					
						
							| 
									
										
										
										
											2018-11-10 22:36:30 +05:30
										 |  |  |         simplifies but also limits. This two-argument command makes no | 
					
						
							|  |  |  |         assumptions, so taps can be cloned from places other than GitHub and | 
					
						
							| 
									
										
										
										
											2020-02-19 10:56:44 +00:00
										 |  |  |         using protocols other than HTTPS, e.g. SSH, git, HTTP, FTP(S), rsync. | 
					
						
							| 
									
										
										
										
											2018-11-10 22:36:30 +05:30
										 |  |  |       EOS | 
					
						
							| 
									
										
										
										
											2021-05-07 09:29:19 -04:00
										 |  |  |       switch "--full", | 
					
						
							| 
									
										
										
										
											2022-06-28 10:09:59 +01:00
										 |  |  |              description: "Convert a shallow clone to a full clone without untapping. Taps are only cloned as " \ | 
					
						
							| 
									
										
										
										
											2021-12-17 00:17:15 +00:00
										 |  |  |                           "shallow clones if `--shallow` was originally passed.", | 
					
						
							| 
									
										
										
										
											2023-03-29 20:49:29 +02:00
										 |  |  |              replacement: false, | 
					
						
							|  |  |  |              disable:     true | 
					
						
							| 
									
										
										
										
											2021-05-07 09:29:19 -04:00
										 |  |  |       switch "--shallow", | 
					
						
							| 
									
										
										
										
											2021-12-17 00:17:15 +00:00
										 |  |  |              description: "Fetch tap as a shallow clone rather than a full clone. Useful for continuous integration.", | 
					
						
							| 
									
										
										
										
											2023-03-29 20:49:29 +02:00
										 |  |  |              replacement: false, | 
					
						
							|  |  |  |              disable:     true | 
					
						
							| 
									
										
										
										
											2022-05-06 11:57:43 +08:00
										 |  |  |       switch "--[no-]force-auto-update", | 
					
						
							| 
									
										
										
										
											2022-06-28 10:09:59 +01:00
										 |  |  |              description: "Auto-update tap even if it is not hosted on GitHub. By default, only taps " \ | 
					
						
							| 
									
										
										
										
											2019-04-30 08:44:35 +01:00
										 |  |  |                           "hosted on GitHub are auto-updated (for performance reasons)." | 
					
						
							| 
									
										
										
										
											2021-10-11 17:00:43 +08:00
										 |  |  |       switch "--custom-remote", | 
					
						
							|  |  |  |              description: "Install or change a tap with a custom remote. Useful for mirrors." | 
					
						
							| 
									
										
										
										
											2018-11-10 22:36:30 +05:30
										 |  |  |       switch "--repair", | 
					
						
							| 
									
										
										
										
											2019-04-30 08:44:35 +01:00
										 |  |  |              description: "Migrate tapped formulae from symlink-based to directory-based structure." | 
					
						
							| 
									
										
										
										
											2022-09-05 13:57:22 +01:00
										 |  |  |       switch "--eval-all", | 
					
						
							|  |  |  |              description: "Evaluate all the formulae, casks and aliases in the new tap to check validity. " \ | 
					
						
							| 
									
										
										
										
											2023-02-10 23:15:40 -05:00
										 |  |  |                           "Implied if `HOMEBREW_EVAL_ALL` is set." | 
					
						
							| 
									
										
										
										
											2023-07-05 19:15:48 +01:00
										 |  |  |       switch "--force", | 
					
						
							|  |  |  |              description: "Force install core taps even under API mode." | 
					
						
							| 
									
										
										
										
											2020-07-30 18:40:10 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-10 14:26:40 -05:00
										 |  |  |       named_args :tap, max: 2
 | 
					
						
							| 
									
										
										
										
											2018-11-10 22:36:30 +05:30
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-29 22:35:10 +01:00
										 |  |  |   sig { void } | 
					
						
							| 
									
										
										
										
											2012-03-02 20:28:54 +00:00
										 |  |  |   def tap | 
					
						
							| 
									
										
										
										
											2020-07-30 18:40:10 +02:00
										 |  |  |     args = tap_args.parse | 
					
						
							| 
									
										
										
										
											2018-11-10 22:36:30 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  |     if args.repair? | 
					
						
							| 
									
										
										
										
											2024-02-20 15:10:26 +01:00
										 |  |  |       Tap.select(&:installed?).each do |tap| | 
					
						
							|  |  |  |         tap.link_completions_and_manpages | 
					
						
							|  |  |  |         tap.fix_remote_configuration | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2020-03-04 17:28:15 +00:00
										 |  |  |     elsif args.no_named? | 
					
						
							| 
									
										
										
										
											2024-02-28 20:18:55 +01:00
										 |  |  |       puts Tap.select(&:installed?) | 
					
						
							| 
									
										
										
										
											2012-03-02 20:28:54 +00:00
										 |  |  |     else | 
					
						
							| 
									
										
										
										
											2020-03-04 17:28:15 +00:00
										 |  |  |       tap = Tap.fetch(args.named.first) | 
					
						
							| 
									
										
										
										
											2015-11-10 18:33:57 +08:00
										 |  |  |       begin | 
					
						
							| 
									
										
										
										
											2020-03-04 17:28:15 +00:00
										 |  |  |         tap.install clone_target:      args.named.second, | 
					
						
							| 
									
										
										
										
											2022-05-06 11:57:43 +08:00
										 |  |  |                     force_auto_update: args.force_auto_update?, | 
					
						
							| 
									
										
										
										
											2021-10-11 17:00:43 +08:00
										 |  |  |                     custom_remote:     args.custom_remote?, | 
					
						
							| 
									
										
										
										
											2022-09-05 13:57:22 +01:00
										 |  |  |                     quiet:             args.quiet?, | 
					
						
							| 
									
										
										
										
											2023-07-05 19:15:48 +01:00
										 |  |  |                     verify:            args.eval_all? || Homebrew::EnvConfig.eval_all?, | 
					
						
							|  |  |  |                     force:             args.force? | 
					
						
							| 
									
										
										
										
											2021-10-11 17:00:43 +08:00
										 |  |  |       rescue TapRemoteMismatchError, TapNoCustomRemoteError => e | 
					
						
							| 
									
										
										
										
											2016-04-04 03:18:55 -07:00
										 |  |  |         odie e | 
					
						
							| 
									
										
										
										
											2020-02-02 16:36:01 +01:00
										 |  |  |       rescue TapAlreadyTappedError | 
					
						
							|  |  |  |         nil | 
					
						
							| 
									
										
										
										
											2015-11-10 09:12:25 +00:00
										 |  |  |       end | 
					
						
							| 
									
										
										
										
											2012-03-02 20:28:54 +00:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2012-03-16 12:49:09 +00:00
										 |  |  | end |