From 9535d671f996c3bc95910ef9e6bc7af8245398eb Mon Sep 17 00:00:00 2001 From: Lucas Garron Date: Thu, 7 Nov 2024 01:54:50 -0800 Subject: [PATCH] [openscad-auto] Install `openscad-auto` normally. This avoids syntax errors until Rust supports the syntax in its tooling: https://github.com/rust-lang/cargo/issues/12207#issuecomment-1967766775 --- Formula/openscad-auto.rb | 30 ++++++------------------------ README.md | 2 +- rust-toolchain.toml | 2 -- scripts/app-tools/openscad-auto.rs | 14 -------------- 4 files changed, 7 insertions(+), 41 deletions(-) delete mode 100644 rust-toolchain.toml diff --git a/Formula/openscad-auto.rb b/Formula/openscad-auto.rb index 6764cc43..d85a5909 100644 --- a/Formula/openscad-auto.rb +++ b/Formula/openscad-auto.rb @@ -2,32 +2,14 @@ class OpenscadAuto < Formula desc "🟡 Run `openscad` to convert `.scad` file to `.3mf` or `.stl` file with defaults." - homepage "https://github.com/lgarron/scripts" - head "https://github.com/lgarron/scripts.git", :branch => "main" + homepage "https://github.com/lgarron/dotfiles" + head "https://github.com/lgarron/dotfiles.git", :branch => "main" - # We'd add `openscad@snapshot` as a dependency, but that formula is a cask because of the associated app and casks can't be used as dependencies. :-/ - depends_on "terminal-notifier" - - # TODO: figure out how to depend on Rust nightly. - # depends_on "rust" - - def caveats - <<~EOS -1. Make sure to run: - - rustup toolchain install nightly - -2. Completions cannot currently be automatically installed. Run: - - openscad-auto --completions fish > ~/.config/fish/completions/openscad-auto.fish" -EOS - end + depends_on "rust" => :build def install - bin.install "app-tools/openscad-auto.rs" => "openscad-auto" - # TODO - # generate_completions_from_executable(bin/"openscad-auto", "--completions") - # generate_completions_from_executable(system "cargo", "+nightly", "-Zscript", bin/"openscad-auto", "--completions") - # (fish_completion/"openscad-auto.fish").write Utils.safe_popen_read({ "SHELL" => "fish" }, "/Users/lgarron/.cache/cargo/bin/cargo", "+nightly", "-Zscript", "--", "openscad-auto", "--completions", "fish") + system "cargo", "install", "--bin", "openscad-auto", *std_cargo_args() + + generate_completions_from_executable(bin/"openscad-auto", "--completions") end end diff --git a/README.md b/README.md index a8118c26..f2ff383e 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ See [`./exported/`](./exported/) for files that must be manually exported/import - `bash` (deprecated, except for bootstrapping) - `fish` - `bun` for TypeScript -- `cargo +nightly -Zscript` +- Rust - Homebrew ## XDG Base Directory Spec diff --git a/rust-toolchain.toml b/rust-toolchain.toml deleted file mode 100644 index 5d56faf9..00000000 --- a/rust-toolchain.toml +++ /dev/null @@ -1,2 +0,0 @@ -[toolchain] -channel = "nightly" diff --git a/scripts/app-tools/openscad-auto.rs b/scripts/app-tools/openscad-auto.rs index b8930353..766c96f4 100755 --- a/scripts/app-tools/openscad-auto.rs +++ b/scripts/app-tools/openscad-auto.rs @@ -1,17 +1,3 @@ -#!/usr/bin/env -S cargo +nightly -Zscript --quiet -- ---- -[package] -edition = "2021" -[dependencies] -chrono = "0.4.38" -clap = { version = "4.5.20", features = ["derive"] } -clap_complete = "4.5.33" -script-helpers = "0.1.0" -shell-quote = "0.7.1" ---- - -// TODO: split out parts of this file into conveniences. - use chrono::Local; use clap::{CommandFactory, Parser, ValueEnum}; use clap_complete::generator::generate;