summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Vink <mike.vink@stater.nl>2023-04-03 12:51:01 +0200
committerMike Vink <mike.vink@stater.nl>2023-04-03 12:51:01 +0200
commiteb4f40576452137ac0a2c5d4ef079e7aca188b76 (patch)
tree2d06927346c1a01db11493987db0b5adb4f26bd6
parent425b80de40ad0702888934fb21e4b99ff454558f (diff)
update scripts and shell
-rw-r--r--flake.nix2
-rw-r--r--home.nix9
-rw-r--r--home/neovim.nix2
-rw-r--r--shell-scripts/azdo-switch-project47
4 files changed, 54 insertions, 6 deletions
diff --git a/flake.nix b/flake.nix
index 51e91d5..83266c7 100644
--- a/flake.nix
+++ b/flake.nix
@@ -27,7 +27,7 @@
overlay = nixpkgs.lib.composeManyExtensions [
(import ./overlays/vimPlugins.nix {inherit pkgs;})
- (import ./overlays/fennel-language-server.nix {inherit pkgs;})
+ # (import ./overlays/fennel-language-server.nix {inherit pkgs;})
];
pkgs = import nixpkgs {
diff --git a/home.nix b/home.nix
index bb5d41d..90777db 100644
--- a/home.nix
+++ b/home.nix
@@ -10,7 +10,6 @@
home.username = username;
home.stateVersion = "22.05";
-
programs.home-manager.enable = true;
home.sessionVariables = {
@@ -36,9 +35,11 @@
s = "sudo nixos-rebuild switch --flake ${config.home.homeDirectory}/flake#";
b = "/run/current-system/bin/switch-to-configuration boot";
h = "home-manager switch --flake ${config.home.homeDirectory}/flake#mvinkio --impure";
- V = "xrandr --output HDMI1 --auto --output eDP1 --off";
- v = "xrandr --output eDP1 --auto --output HDMI1 --off";
- vV = "xrandr --output eDP1 --auto --output HDMI1 --off";
+ fa = "azdo-switch-project";
+ v = "nvim";
+ M = "xrandr --output HDMI1 --auto --output eDP1 --off";
+ m = "xrandr --output eDP1 --auto --output HDMI1 --off";
+ mM = "xrandr --output eDP1 --auto --output HDMI1 --off";
newflake = "nix flake new -t ~/flake ";
};
};
diff --git a/home/neovim.nix b/home/neovim.nix
index bea4e22..e5bba83 100644
--- a/home/neovim.nix
+++ b/home/neovim.nix
@@ -34,7 +34,7 @@
bashInteractive
fennel
sumneko-lua-language-server
- fennel-language-server
+ #fennel-language-server
pyright
gopls
yaml-language-server
diff --git a/shell-scripts/azdo-switch-project b/shell-scripts/azdo-switch-project
new file mode 100644
index 0000000..0dd23f2
--- /dev/null
+++ b/shell-scripts/azdo-switch-project
@@ -0,0 +1,47 @@
+#!@bash@/bin/bash
+eval "$(pass show work/shell-scripts/secrets)"
+
+LIST_PROJECTS="/_apis/projects?api-version=7.1-preview.4"
+AUTH_HEADER="Authorization: Basic $WORK_AZDO_GIT_AUTH"
+LIST_REPOSITORIES="/_apis/git/repositories?api-version=7.1-preview.1"
+GIT_DIR="$HOME/projects/"
+if [ ! -d $GIT_DIR ]; then
+ mkdir -p $GIT_DIR
+fi
+MAX_REPOS=20
+
+COUNT=$(find "$GIT_DIR" -mindepth 1 -maxdepth 1 -type d | wc -l)
+if [ "$COUNT" -gt "$MAX_REPOS" ]
+then
+ STALE=$(( COUNT - MAX_REPOS ))
+ OLDEST=$(find "$GIT_DIR" -mindepth 1 -maxdepth 1 -type d -printf '%T@ %p\n' 2>/dev/null \
+ | sort -n | head -n$STALE | cut -d' ' -f2)
+
+ for dir in $OLDEST
+ do
+ rm -i -r $dir
+ done
+fi
+
+
+echo "curl -s -H \"$AUTH_HEADER\" $WORK_AZDO_GIT_ORG_URL$LIST_PROJECTS"
+PROJECT=$(curl -s -H "$AUTH_HEADER" $WORK_AZDO_GIT_ORG_URL$LIST_PROJECTS \
+| jq '
+.value[].name
+' \
+| xargs -I{} bash -c "
+curl -s -H '$AUTH_HEADER' $WORK_AZDO_GIT_ORG_URL/{}$LIST_REPOSITORIES \
+| jq '
+.value[].name
+' \
+| awk '{ gsub(/\"/, \"\", \$1); printf \"{}/_git/%s\\n\", \$1 }'
+" \
+| fzf)
+
+DEST_DIR="$GIT_DIR/$(echo $PROJECT | cut -d '/' -f3)"
+if [ ! -d $DEST_DIR ]
+then
+ git clone $WORK_AZDO_GIT_ORG_URL/$PROJECT $DEST_DIR
+fi
+cd $DEST_DIR
+$EDITOR