From 1d2e5d0571c45772ded376fb5e1e371f7d67b587 Mon Sep 17 00:00:00 2001 From: coolneng Date: Thu, 20 Oct 2022 09:00:05 +0200 Subject: [PATCH] Refactor directory creation in project-init --- scripts/.local/share/scripts/project-init | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/.local/share/scripts/project-init b/scripts/.local/share/scripts/project-init index 3f523b1..b218027 100755 --- a/scripts/.local/share/scripts/project-init +++ b/scripts/.local/share/scripts/project-init @@ -34,6 +34,12 @@ direnv_integration() { direnv allow } +create_dir() { + if [ ! -d "$1" ]; then + mkdir "$1" + fi +} + if [ $# != 1 ]; then usage fi @@ -41,24 +47,27 @@ fi type=$1 if [ "$type" = "git" ]; then - mkdir src data copy_nix_files "flake" + create_dir data + create_dir src git_initialization direnv_integration "flake" elif [ "$type" = "remote-git" ]; then touch README.org cp ~/Documents/IT/gpl-3.0.md LICENSE.md copy_nix_files "flake" - mkdir src tests data + create_dir data + create_dir src git_initialization direnv_integration "flake" elif [ "$type" = "doc" ]; then - mkdir docs docs/assets - touch docs/Summary.org + create_dir assets + touch Report.org touch .project elif [ "$type" = "src" ]; then copy_nix_files "nix" - mkdir src data + create_dir data + create_dir src touch .project direnv_integration "nix" elif [ "$type" = "nix-ld" ]; then