mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-13 23:49:04 +08:00
edit: enable Sublime Text project view
This commit is contained in:
parent
bdc3391a13
commit
04c8e896a5
4
.gitignore
vendored
4
.gitignore
vendored
@ -194,5 +194,7 @@
|
||||
# Unignore tests' bundle config
|
||||
!/Library/Homebrew/test/.bundle/config
|
||||
|
||||
# Unignore vscode configuration
|
||||
# Unignore editor configuration
|
||||
!/.sublime
|
||||
/.sublime/homebrew.sublime-workspace
|
||||
!/.vscode
|
||||
|
28
.sublime/homebrew.sublime-project
Normal file
28
.sublime/homebrew.sublime-project
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"folders":
|
||||
[
|
||||
{
|
||||
"//": "Generated based on the contents of our .gitignore",
|
||||
"path": "..",
|
||||
"folder_exclude_patterns": [
|
||||
"Caskroom",
|
||||
"Cellar",
|
||||
"Frameworks",
|
||||
"bin",
|
||||
"etc",
|
||||
"include",
|
||||
"lib",
|
||||
"opt",
|
||||
"sbin",
|
||||
"share",
|
||||
"var",
|
||||
"Library/Homebrew/LinkedKegs",
|
||||
"Library/Homebrew/Aliases"
|
||||
],
|
||||
"follow_symlinks": true
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"tab_size": 2
|
||||
}
|
||||
}
|
@ -40,16 +40,24 @@ module Homebrew
|
||||
EOS
|
||||
end
|
||||
|
||||
paths = args.named.to_paths.select do |path|
|
||||
next path if path.exist?
|
||||
paths = if args.named.empty?
|
||||
# Sublime requires opting into the project editing path,
|
||||
# as opposed to VS Code which will infer from the .vscode path
|
||||
if which_editor == "subl"
|
||||
["--project", "#{HOMEBREW_REPOSITORY}/.sublime/homebrew.sublime-project"]
|
||||
else
|
||||
# If no formulae are listed, open the project root in an editor.
|
||||
[HOMEBREW_REPOSITORY]
|
||||
end
|
||||
else
|
||||
args.named.to_paths.select do |path|
|
||||
next path if path.exist?
|
||||
|
||||
raise UsageError, "#{path} doesn't exist on disk. " \
|
||||
"Run #{Formatter.identifier("brew create --set-name #{path.basename} $URL")} " \
|
||||
"to create a new formula!"
|
||||
end.presence
|
||||
|
||||
# If no formulae are listed, open the project root in an editor.
|
||||
paths ||= [HOMEBREW_REPOSITORY]
|
||||
raise UsageError, "#{path} doesn't exist on disk. " \
|
||||
"Run #{Formatter.identifier("brew create --set-name #{path.basename} $URL")} " \
|
||||
"to create a new formula!"
|
||||
end.presence
|
||||
end
|
||||
|
||||
exec_editor(*paths)
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user