diff --git a/Formula/code-cli.rb b/Formula/code-cli.rb new file mode 100644 index 00000000000..8dcc1ff627b --- /dev/null +++ b/Formula/code-cli.rb @@ -0,0 +1,32 @@ +class CodeCli < Formula + desc "Command-line interface built-in Visual Studio Code" + homepage "https://github.com/microsoft/vscode" + url "https://github.com/microsoft/vscode/archive/refs/tags/1.74.0.tar.gz" + sha256 "171435a9e2736d323af78591593f8a59eac52d26e98ba817daa37261e835aa1f" + license "MIT" + head "https://github.com/microsoft/vscode.git", branch: "main" + + livecheck do + url :stable + strategy :github_latest + end + + depends_on "rust" => :build + + conflicts_with cask: "visual-studio-code" + + def install + ENV["VSCODE_CLI_NAME_LONG"] = "Code OSS" + ENV["VSCODE_CLI_VERSION"] = version + + cd "cli" do + system "cargo", "install", *std_cargo_args + end + end + + test do + assert_match "Successfully removed all unused servers", + shell_output("#{bin}/code tunnel prune") + assert_match version.to_s, shell_output("#{bin}/code --version") + end +end