From 058688f239d9acd11429e931dc6a33f3f57671ab Mon Sep 17 00:00:00 2001 From: Issy Long Date: Sat, 10 Aug 2024 00:23:29 +0100 Subject: [PATCH] utils/link: Bump to Sorbet `typed: strict` --- Library/Homebrew/utils/link.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/utils/link.rb b/Library/Homebrew/utils/link.rb index 09e56d2696..01a5211b3e 100644 --- a/Library/Homebrew/utils/link.rb +++ b/Library/Homebrew/utils/link.rb @@ -1,9 +1,10 @@ -# typed: true +# typed: strict # frozen_string_literal: true module Utils # Helper functions for creating symlinks. module Link + sig { params(src_dir: Pathname, dst_dir: Pathname, command: String, link_dir: T::Boolean).void } def self.link_src_dst_dirs(src_dir, dst_dir, command, link_dir: false) return unless src_dir.exist? @@ -38,6 +39,7 @@ module Utils end private_class_method :link_src_dst_dirs + sig { params(src_dir: Pathname, dst_dir: Pathname, unlink_dir: T::Boolean).void } def self.unlink_src_dst_dirs(src_dir, dst_dir, unlink_dir: false) return unless src_dir.exist? @@ -52,26 +54,31 @@ module Utils end private_class_method :unlink_src_dst_dirs + sig { params(path: Pathname, command: String).void } def self.link_manpages(path, command) link_src_dst_dirs(path/"manpages", HOMEBREW_PREFIX/"share/man/man1", command) end + sig { params(path: Pathname).void } def self.unlink_manpages(path) unlink_src_dst_dirs(path/"manpages", HOMEBREW_PREFIX/"share/man/man1") end + sig { params(path: Pathname, command: String).void } def self.link_completions(path, command) link_src_dst_dirs(path/"completions/bash", HOMEBREW_PREFIX/"etc/bash_completion.d", command) link_src_dst_dirs(path/"completions/zsh", HOMEBREW_PREFIX/"share/zsh/site-functions", command) link_src_dst_dirs(path/"completions/fish", HOMEBREW_PREFIX/"share/fish/vendor_completions.d", command) end + sig { params(path: Pathname).void } def self.unlink_completions(path) unlink_src_dst_dirs(path/"completions/bash", HOMEBREW_PREFIX/"etc/bash_completion.d") unlink_src_dst_dirs(path/"completions/zsh", HOMEBREW_PREFIX/"share/zsh/site-functions") unlink_src_dst_dirs(path/"completions/fish", HOMEBREW_PREFIX/"share/fish/vendor_completions.d") end + sig { params(path: Pathname, command: String).void } def self.link_docs(path, command) link_src_dst_dirs(path/"docs", HOMEBREW_PREFIX/"share/doc/homebrew", command, link_dir: true) end