{ pkgs', ... }: pkgs'.writeShellScriptBin "create-new-class" '' source ${pkgs'.common}/bin/common echo_section "create new component class" echo_hint "The command is executed in the current working directory and not in a nix derivation." cd_working_dir echo_section "create a new component class" echo_step "enter new component class name" name=$(${pkgs'.gum}/bin/gum input --placeholder "Enter new component class name") if [[ -z "$name" ]]; then echo_fail "Component class name is empty. Exiting." exit 1 fi echo_step "select target directory" cd source targetPath=$(${pkgs'.gum}/bin/gum file --directory --file=false) cd .. if [[ -z "$targetPath" ]]; then echo_fail "Target directory is empty. Exiting." exit 1 fi if [[ ! -d "$targetPath" ]]; then echo_fail "Target directory does not exist. Exiting." exit 1 fi echo_step "create new component class $name in $targetPath" targetPath=$(realpath --relative-to=source "$targetPath") if ! ${pkgs'.nodejs_20}/bin/node development/scripts/createNewClass.mjs --classname="$name" --path="$targetPath"; then echo_fail "script createNewClass.mjs failed, check your JS!" exit 1 fi echo_ok "New component class created" ''