non important commit
This commit is contained in:
parent
2b909bfb6a
commit
4320816d34
1 changed files with 25 additions and 20 deletions
|
|
@ -1,17 +1,20 @@
|
||||||
{pkgs, ...}: {
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
blueprints = ./. + "/project-blueprints";
|
||||||
|
in {
|
||||||
home.packages = [
|
home.packages = [
|
||||||
(pkgs.writeScriptBin "create-project"
|
(pkgs.writeScriptBin "create-project" ''
|
||||||
/*
|
#!${pkgs.nushell}/bin/nu
|
||||||
nu
|
|
||||||
*/
|
def main [
|
||||||
''
|
type?: string
|
||||||
#!${pkgs.nushell}/bin/nu
|
name?: string
|
||||||
|
--local (-l)
|
||||||
|
] {
|
||||||
|
|
||||||
def main [
|
|
||||||
type?: string
|
|
||||||
name?: string
|
|
||||||
--local (-l)
|
|
||||||
] {
|
|
||||||
if $name == null or $type == null {
|
if $name == null or $type == null {
|
||||||
print "Usage: create-project <name> <type> [Options: -l]"
|
print "Usage: create-project <name> <type> [Options: -l]"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -27,7 +30,9 @@
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($"~/.nix-config/home/modules/create-project/project-blueprints/($type)" | path type) != "dir" {
|
let blueprint_dir = "${blueprints}/($type)"
|
||||||
|
|
||||||
|
if ($blueprint_dir | path type) != "dir" {
|
||||||
print "This project type doesn't exist"
|
print "This project type doesn't exist"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
@ -35,12 +40,12 @@
|
||||||
mkdir $name
|
mkdir $name
|
||||||
cd $name
|
cd $name
|
||||||
|
|
||||||
if ($"~/.nix-config/home/modules/create-project/project-blueprints/($type)" | path expand | ls $in | length) > 0 {
|
if ($blueprint_dir | path expand | ls $in | length) > 0 {
|
||||||
glob $"~/.nix-config/home/modules/create-project/project-blueprints/($type)/*" | each { |file| cp $file . }
|
glob $"($blueprint_dir)/*" | each { |file| cp $file . }
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($"./init.sh" | path type) == "file" {
|
if ("./init.sh" | path type) == "file" {
|
||||||
bash $"./init.sh" $name
|
bash "./init.sh" $name
|
||||||
rm "init.sh"
|
rm "init.sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,13 +61,13 @@
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
${pkgs.tea} repos create --name $name
|
${lib.getExe pkgs.tea} repos create --name $name
|
||||||
git remote add origin $"https://git.stribrny.org/max_ag/($name).git"
|
git remote add origin $"https://git.stribrny.org/max_ag/($name).git"
|
||||||
git push -u origin main
|
git push -u origin main
|
||||||
|
|
||||||
print "You are all done"
|
print "You are all done"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
'')
|
'')
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue