From 0d0a78c1e0d09eacfb60bcd4e4641b58a692b81b Mon Sep 17 00:00:00 2001 From: maxstrb Date: Mon, 5 Jan 2026 23:29:53 +0100 Subject: [PATCH] non important commit --- .../modules/create-project/create-project.nix | 95 ++++++++++--------- 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/home/modules/create-project/create-project.nix b/home/modules/create-project/create-project.nix index 9aa3af5..b2a94fe 100644 --- a/home/modules/create-project/create-project.nix +++ b/home/modules/create-project/create-project.nix @@ -7,67 +7,68 @@ in { home.packages = [ (pkgs.writeScriptBin "create-project" '' - #!${pkgs.nushell}/bin/nu + #!${pkgs.nushell}/bin/nu - def main [ - type?: string - name?: string - --local (-l) - ] { + def main [ + type?: string + name?: string + --local (-l) + ] { - if $name == null or $type == null { - print "Usage: create-project [Options: -l]" - exit 1 - } + if $name == null or $type == null { + print "Usage: create-project [Options: -l]" + exit 1 + } - if ($name | str contains "/") or ($name | str contains ".") { - print "This is not a valid name for a project" - exit 1 - } + if ($name | str contains "/") or ($name | str contains ".") { + print "This is not a valid name for a project" + exit 1 + } - if ($type | str contains "/") or ($type | str contains ".") { - print "This is not a valid project type" - exit 1 - } + if ($type | str contains "/") or ($type | str contains ".") { + print "This is not a valid project type" + exit 1 + } - let blueprint_dir = $"${blueprints}/($type)" + let blueprint_dir = $"${blueprints}/($type)" - if ($blueprint_dir | path type) != "dir" { - print "This project type doesn't exist" - exit 1 - } + if ($blueprint_dir | path type) != "dir" { + print "This project type doesn't exist" + exit 1 + } - mkdir $name - cd $name + mkdir $name + cd $name - if ($blueprint_dir | path expand | ls $in | length) > 0 { - glob $"($blueprint_dir)/*" | each { ||file| cp --no-preserve=mode $file . } - } + if ($blueprint_dir | path expand | ls $in | length) > 0 { + glob $"($blueprint_dir)/*" | each { ||file| cp $file . } + chmod -R u+w . + } - if ("./init.sh" | path type) == "file" { - bash "./init.sh" $name - rm "init.sh" - } + if ("./init.sh" | path type) == "file" { + bash "./init.sh" $name + rm "init.sh" + } - echo "use flake" | save .envrc - direnv allow + echo "use flake" | save .envrc + direnv allow - git init - git add . - git commit -m "Project setup" + git init + git add . + git commit -m "Project setup" - if $local { - print "You are all done" - exit 0 - } + if $local { + print "You are all done" + exit 0 + } - ${lib.getExe pkgs.tea} repos create --name $name - git remote add origin $"https://git.stribrny.org/max_ag/($name).git" - git push -u origin main + ${lib.getExe pkgs.tea} repos create --name $name + git remote add origin $"https://git.stribrny.org/max_ag/($name).git" + git push -u origin main - print "You are all done" - exit 0 - } + print "You are all done" + exit 0 + } '') ]; }