diff options
| -rw-r--r-- | home/packages.nix | 16 | ||||
| -rw-r--r-- | shell-scripts/gh-switch-project | 15 |
2 files changed, 25 insertions, 6 deletions
diff --git a/home/packages.nix b/home/packages.nix index fccc17f..4de092a 100644 --- a/home/packages.nix +++ b/home/packages.nix @@ -22,7 +22,9 @@ ripgrep inotify-tools fzf - ] ++ (import ../shell-scripts.nix {inherit pkgs config;}); + github-cli + ] + ++ (import ../shell-scripts.nix {inherit pkgs config;}); mike-extra-packages = with pkgs; [ (nerdfonts.override {fonts = ["FiraCode"];}) docker @@ -32,9 +34,11 @@ xclip ]; in { - home.packages = core-packages ++ ( - if (username == "mike") - then mike-extra-packages - else [] - ); + home.packages = + core-packages + ++ ( + if (username == "mike") + then mike-extra-packages + else [] + ); } diff --git a/shell-scripts/gh-switch-project b/shell-scripts/gh-switch-project new file mode 100644 index 0000000..b7054ca --- /dev/null +++ b/shell-scripts/gh-switch-project @@ -0,0 +1,15 @@ +#!@bash@/bin/bash +eval "$(pass show personal/shell-scripts/secrets)" +repo=$(gh repo list --json owner,name -q '.[] | "\(.owner.login)/\(.name)"' | fzf) +GIT_DIR="$HOME/projects" +if [ ! -d $GIT_DIR ]; then + mkdir -p $GIT_DIR +fi + +DEST_DIR="$GIT_DIR/$(echo $repo | cut -d '/' -f2)" +if [ ! -d $DEST_DIR ] +then + gh repo clone $repo $DEST_DIR +fi +cd $DEST_DIR +$EDITOR |
