#!/usr/bin/env nu # SPDX-License-Identifier: AGPL-3.0-only # Copyright (c) 2026 MatrixFurry const formula_path = path self ../Formula const template_path = path self ./template/formula.rb const cmake = [ 'system "cmake" "-S" "." "-B" "build" *std_cmake_args' 'system "cmake" "--build" "build"' 'system "cmake" "--install" "build"' ] const cargo = [ 'system "cargo" "install" *std_cargo_args(features: "example-feature-flag")' ] export def main [ name: string type: string ] { let install_template = match $type { "cmake" => $cmake "cargo" => $cargo _ => {error make -u "Choose a valid template type."} } | str join "\n" open $template_path | str replace "@CLASS@" ($name | str pascal-case) | str replace "@INSTALL@" $install_template | save ($formula_path | path join ($name ++ ".rb")) }