Skip to content

Commit

Permalink
Add more details in error msg on twgit init.
Browse files Browse the repository at this point in the history
Enhance contextual help of all commands.
closes #47
  • Loading branch information
geoffroy-aubry committed Apr 17, 2012
1 parent 7bb86db commit b6e0fdc
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 22 deletions.
3 changes: 2 additions & 1 deletion inc/common.inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,8 @@ function assert_valid_tag_name () {
local tag="$1"
assert_valid_ref_name "$tag"
processing 'Check valid tag name...'
$(echo "$tag" | grep -qP '^'$TWGIT_PREFIX_TAG'[0-9]+\.[0-9]+\.[0-9]+$') || die "Unauthorized tag name: '<b>$tag</b>'!"
$(echo "$tag" | grep -qP '^'$TWGIT_PREFIX_TAG'[0-9]+\.[0-9]+\.[0-9]+$') || \
die "Unauthorized tag name: '<b>$tag</b>'! Must use major.minor.revision format, e.g. 1.2.3."
processing "Check whether tag '$tag' already exists..."
has "$tag" $(get_all_tags) && die "Tag '<b>$tag</b>' already exists! Try: twgit tag list"
}
Expand Down
5 changes: 3 additions & 2 deletions inc/twgit_feature.inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ function usage () {
help_detail '<b>start <featurename> [-d]</b>'
help_detail ' Create both a new local and remote feature, or fetch the remote feature,'
help_detail ' or checkout the local feature. Add <b>-d</b> to delete beforehand local feature'
help_detail ' if exists.'
help_detail " Prefix '$TWGIT_PREFIX_FEATURE' will be added to the specified <b><featurename></b>."; echo
help_detail ' if exists.'; echo
help_detail '<b>status [<featurename>]</b>'
help_detail ' Display information about specified feature: long name if a connector is'
help_detail ' setted, last commit, status between local and remote feature and execute'
help_detail ' a git status if specified feature is the current branch.'
help_detail ' If no <b><featurename></b> is specified, then use current feature.'; echo
help_detail "Prefix '$TWGIT_PREFIX_FEATURE' will be added to <b><featurename></b> and <b><newfeaturename></b>"
help_detail "parameters."; echo
help_detail '<b>[help]</b>'
help_detail ' Display this help.'; echo
}
Expand Down
8 changes: 5 additions & 3 deletions inc/twgit_hotfix.inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ function usage () {
help_detail ' List current hotfix. Add <b>-F</b> to do not make fetch.'; echo
help_detail '<b>remove <hotfixname></b>'
help_detail ' Remove both local and remote specified hotfix branch.'
help_detail ' Create a new tag to distinguish clearly the next hotfix from this one.'; echo
help_detail ' Despite that, create the same tag as finish action to clearly distinguish'
help_detail ' the next hotfix from this one.'
help_detail " Prefix '$TWGIT_PREFIX_HOTFIX' will be added to the specified <b><hotfixname></b>."; echo
help_detail '<b>start</b>'
help_detail ' Create both a new local and remote hotfix, or fetch the remote hotfix,'
help_detail ' or checkout the local hotfix.'
help_detail ' Hotfix name will be: major.minor.(revision+1)'
help_detail " Prefix '$TWGIT_PREFIX_HOTFIX' will be added to the specified <b><hotfixname></b>."; echo
help_detail ' Hotfix name will be generated by incrementing revision of the last tag:'
help_detail " v1.2.3 > ${TWGIT_PREFIX_HOTFIX}1.2.4"; echo
help_detail '<b>[help]</b>'
help_detail ' Display this help.'; echo
}
Expand Down
20 changes: 10 additions & 10 deletions inc/twgit_release.inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ function usage () {
help_detail ' Add <b>-I</b> to run in non-interactive mode (always say yes).'; echo
help_detail '<b>remove <releasename></b>'
help_detail ' Remove both local and remote specified release branch.'
help_detail ' Create a new tag to distinguish clearly the next release from this one.'; echo
help_detail ' Despite that, create the same tag as finish action to clearly distinguish'
help_detail ' the next release from this one.'; echo
help_detail '<b>reset <releasename> [-I|-M|-m]</b>'
help_detail ' Call <b>twgit remove <releasename></b>, then <b>twgit start [-I|-M|-m]</b>.'
help_detail ' Handle options of <b>twgit start</b>.'; echo
help_detail '<b>start [<releasename>] [-I|-M|-m]</b>'
help_detail ' Create both a new local and remote release,'
help_detail ' or fetch the remote release if exists on remote repository,'
help_detail ' or checkout the local release.'
help_detail ' Add <b>-I</b> to run in non-interactive mode (always say yes).'
help_detail " Prefix '$TWGIT_PREFIX_RELEASE' will be added to the specified <b><releasename></b>."
help_detail ' If no <b><releasename></b> is specified, a name will be generated by'
help_detail ' incrementing from last tag:'
help_detail ' <b>-M</b> for a new major version'
help_detail ' <b>-m</b> for a new minor version (default)'; echo
help_detail ' Create both a new local and remote release, or fetch the remote release,'
help_detail ' or checkout the local release. Add <b>-I</b> to run in non-interactive mode'
help_detail ' (always say yes). If no <b><releasename></b> is specified, a name will be'
help_detail ' generated by incrementing the last tag (e.g. v1.2.3):'
help_detail " <b>-M</b> for a new major version (> ${TWGIT_PREFIX_RELEASE}2.0.0)"
help_detail " <b>-m</b> for a new minor version (default, > ${TWGIT_PREFIX_RELEASE}1.3.0)"; echo
help_detail "Prefix '$TWGIT_PREFIX_RELEASE' will be added to <b><releasename></b> parameters."
help_detail "Prefix '$TWGIT_PREFIX_TAG' will be added to <b><tagname></b> parameters."; echo
help_detail '<b>[help]</b>'
help_detail ' Display this help.'; echo
}
Expand Down
14 changes: 8 additions & 6 deletions twgit
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ function usage () {
help_detail '<b>tag</b> Manage your tags.'
echo
help_detail '<b>clean</b> Help to remove branches no longer tracked.'
help_detail '<b>init <starttag> [<url>]</b>'
help_detail '<b>init <tagname> [<url>]</b>'
help_detail ' Initialize git repository for twgit:'
help_detail ' - git init if necessary'
help_detail " - add remote $TWGIT_ORIGIN <b><url></b> if necessary"
help_detail " - create '$TWGIT_STABLE' branch if not exists,"
help_detail " or pull '$TWGIT_ORIGIN/$TWGIT_STABLE' branch if exists"
help_detail ' - create the <b><starttag></b> tag on HEAD of stable'
help_detail ' - git init if necessary'
help_detail " - add remote $TWGIT_ORIGIN <b><url></b> if necessary"
help_detail " - create '$TWGIT_STABLE' branch if not exists, or pull '$TWGIT_ORIGIN/$TWGIT_STABLE'"
help_detail " branch if exists"
help_detail ' - create <b><tagname></b> tag on HEAD of stable, e.g. 1.2.3, using'
help_detail ' major.minor.revision format. '
help_detail " Prefix '$TWGIT_PREFIX_TAG' will be added to the specified <b><tagname></b>."
help_detail ' A remote repository must exists.'
help_detail '<b>update</b> Force update twgit check.'
help_detail '<b>[help]</b> Display this help.'
Expand Down

0 comments on commit b6e0fdc

Please sign in to comment.