From 0e9051aaaac7c55ed5a4f97835a2da12ffcfeae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Fri, 17 Sep 2021 15:26:55 +0200 Subject: [PATCH] feat(shell.nix): add --force for deploying dirt --- shell.nix | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/shell.nix b/shell.nix index 89b1b51..0b51a87 100644 --- a/shell.nix +++ b/shell.nix @@ -76,11 +76,20 @@ in pkgs.mkShell { eval "$(${pkgs.nix}/bin/nix-build --no-out-link "${toString ./.}/deploy.nix" -A "$1")" ''; in pkgs.writers.writeDashBin "niveum-deploy" '' - if [ -z "$(${pkgs.git}/bin/git status --porcelain)" ]; then + deploy() { ${pkgs.parallel}/bin/parallel --line-buffer --tagstring '{}' -q ${deployCommand} '{1}' ::: "$@" + } + + if [ -z "$(${pkgs.git}/bin/git status --porcelain)" ]; then + deploy "$@" else - echo Working directory is dirty. Not deploying. - exit 1 + if [ "$1" = --force ]; then + shift + deploy "$@" + else + echo Working directory is dirty. Not deploying. + exit 1 + fi fi '')