diff options
author | Parabola git <git@parabola.nu> | 2016-07-08 01:50:36 +0000 |
---|---|---|
committer | Parabola git <git@parabola.nu> | 2016-07-08 01:50:36 +0000 |
commit | d757e49a4042b3659c906a2bb404abd6e9eb853f (patch) | |
tree | 1f2f301e1272485935b0c5cff190bf83aba96619 /git-shell-commands/help | |
parent | df6c05258268304f9c2d96d34e038cebfc7950d2 (diff) |
improve "help" text
Diffstat (limited to 'git-shell-commands/help')
-rwxr-xr-x | git-shell-commands/help | 29 |
1 files changed, 24 insertions, 5 deletions
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 |