From f0957ceb7bfa55a4b6727d992503e3c5e5f2a3e7 Mon Sep 17 00:00:00 2001 From: LuKe Date: Thu, 18 May 2023 18:40:35 -0400 Subject: [PATCH] cross platform! --- gclone | 8 +++++++- gpull | 2 +- gpush | 2 +- link | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gclone b/gclone index aff6b3b..4fcd8ab 100755 --- a/gclone +++ b/gclone @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if [[ -z "$1" ]]; then printf 'Need a project:\n\n' >&2 pass show gitea/token >&2 @@ -24,7 +24,13 @@ if [[ "$project" == 'pass' ]]; then pass git pull "token_url" else readarray -t out <<< "$(git clone "$token_url" 2>&1)" + printf 'out: %s\n' "${out[@]}" new_dir="$(awk -F\' '{print $2}' <<< "$out")" + printf 'new dir: %s\n' "$new_dir" + if [[ -z "$new_dir" ]]; then + printf 'could not get dir from git clone.\n' >&2 + exit 1 + fi cd "$new_dir" git config user.signingkey "$gpg_key"! diff --git a/gpull b/gpull index 7794fc6..a6a4f1b 100755 --- a/gpull +++ b/gpull @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if [[ -z "$1" ]]; then project="$(basename $(pwd))" diff --git a/gpush b/gpush index 8b2ae56..6fdc0b8 100755 --- a/gpush +++ b/gpush @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if [[ -z "$1" ]]; then project="$(basename $(pwd))" diff --git a/link b/link index 5ad7d94..242955c 100755 --- a/link +++ b/link @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash local_bins=( "${HOME}/bin"