From d757e49a4042b3659c906a2bb404abd6e9eb853f Mon Sep 17 00:00:00 2001 From: Parabola git Date: Fri, 8 Jul 2016 01:50:36 +0000 Subject: improve "help" text --- git-shell-commands/change-description | 6 +++--- git-shell-commands/change-owner | 6 +++--- git-shell-commands/create-bare-repo | 6 +++--- git-shell-commands/delete-repo | 6 +++--- git-shell-commands/help | 29 ++++++++++++++++++++++++----- 5 files changed, 36 insertions(+), 17 deletions(-) diff --git a/git-shell-commands/change-description b/git-shell-commands/change-description index 16b7ad2..cb22171 100755 --- a/git-shell-commands/change-description +++ b/git-shell-commands/change-description @@ -1,7 +1,7 @@ #!/bin/bash -# * change-description -# Change the project description, needs "description" in the project -# ssh git@host change-description repo "description" +# * change-description REPO DESCRIPTION +# Change the project description +# Example: change-description packages/libretools "Tools for working on Parabola" set -e diff --git a/git-shell-commands/change-owner b/git-shell-commands/change-owner index 8b59388..2b6f6ac 100755 --- a/git-shell-commands/change-owner +++ b/git-shell-commands/change-owner @@ -1,7 +1,7 @@ #!/bin/bash -# * change-owner -# Change the owner project -# ssh git@host change-owner repo "Hacklab" +# * change-owner REPO OWNER +# Change the project owner +# Example: change-owner packages/libretools "Luke Shumaker" set -e diff --git a/git-shell-commands/create-bare-repo b/git-shell-commands/create-bare-repo index 817ac1b..4cc63cd 100755 --- a/git-shell-commands/create-bare-repo +++ b/git-shell-commands/create-bare-repo @@ -1,7 +1,7 @@ #!/bin/bash -# * create-bare-repo -# Allows users to create repo.git -# ssh git@host create-bare-repo repo1 repo2 ... +# * create-bare-repo REPO [REPO2...] +# Allows users to create REPO.git +# Example: create-bare-repo packages/libretools packages/pbs-tools set -e diff --git a/git-shell-commands/delete-repo b/git-shell-commands/delete-repo index 41b1d76..04e896b 100755 --- a/git-shell-commands/delete-repo +++ b/git-shell-commands/delete-repo @@ -1,7 +1,7 @@ #!/bin/bash -# * delete-repo -# Allows users to delete repositories permanently -# ssh git@host delete-repo repo1 repo2 ... +# * delete-repo REPO [REPO2...] +# Allows users to delete REPO.git permanently +# Example: delete-repo packages/libretools packages/pbs-tools set -e diff --git a/git-shell-commands/help b/git-shell-commands/help index f2970d5..0792cb5 100755 --- a/git-shell-commands/help +++ b/git-shell-commands/help @@ -1,12 +1,31 @@ -#!/bin/sh -# * help +#!/usr/bin/env bash +# * help [COMMAND] # Get enabled commands -# ssh git@host help +# Example: help +# Example: help create-bare-repo set -e +HOSTNAME=git.parabola.nu + +if [[ "$*" = */* ]]; then + printf 'Command names may not contain /\n' + exit 1 +fi + +if test $# = 0; then + cmds=("$(dirname "$0")"/*) +else + cmds=("${@/#/"$(dirname "$0")/"}") +fi + # Gets the initial comment after the shebeng from every git-shell-command -for c in "$(dirname "$0")"/*; do +for c in "${cmds[@]}"; do sed -rn '2,/^[^#]/s/^# ?//p' "$c" echo -done +done | +if test -z "$TERM" || test "$TERM" = dumb; then + sed "s/Example: /&ssh $USER@$HOSTNAME /" +else + cat +fi -- cgit v1.2.3