-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add help messages for each Elegant Git command
`-h`, `--help`, `help` are allowed options to get a help message for any command. The `libexec/git-elegant` is responsible for building and printing help. The commands scripts are responsible for providing the messages. It is described on "Architecture" section of README.md. Also, there are new tests which allow checking of the availability of the help messages. #118
- Loading branch information
Showing
14 changed files
with
451 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,67 @@ _rebase_autoStash=("rebase.autoStash" "false") | |
## Credentials, MAC only | ||
_credential_helper_darwin=("credential.helper" "osxkeychain") | ||
|
||
command-purpose() { | ||
cat <<MESSAGE | ||
Configures current repository. | ||
MESSAGE | ||
} | ||
|
||
command-synopsis() { | ||
cat <<MESSAGE | ||
usage: git elegant acquire-repository | ||
MESSAGE | ||
} | ||
|
||
command-description() { | ||
cat<<MESSAGE | ||
A bunch of git configuration applies to current repository using | ||
\`git config --local\`. The first part is an interactive configuration which | ||
aims to set all user-specific options (identity, editor, etc.). The second batch | ||
applies all options which are required for successful using of Elegant Git. | ||
Finally, the last part is aliasing Elegant Git commands by making them available | ||
as regular Git commands. | ||
Approximate commands flow is | ||
\`\`\`bash | ||
==> git elegant acquire-repository | ||
################ Part 1 ################ | ||
git config --local user.name "Dmytro Serdiuk" | ||
git config --local user.email "[email protected]" | ||
git config --local core.editor vim | ||
################ Part 2 ################ | ||
# "|" char starts non-message lines while writing commit message | ||
git config --local core.commentChar | | ||
# Remove whitespaces when apply a patch | ||
git config --local apply.whitespace fix | ||
# Aliasing Elegant Git commands by making them available as Git commands | ||
git config --local "alias.<command>" "elegant <command>" | ||
# Keeping up-to-date with both branches and tags on the remote | ||
git config --local fetch.prune true | ||
git config --local fetch.pruneTags true | ||
# Rebase local changes while puling remotes refs | ||
git config --local fetch.prune true | ||
git config --local fetch.pruneTags | ||
# Line ending configuration | ||
## on MAC or Linux | ||
git config --local core.autocrlf input | ||
## on Windows | ||
git config --local core.autocrlf true | ||
# Always rebase when pull | ||
git config --local pull.rebase true | ||
# Never autostash if rebase | ||
git config --local rebase.autoStash false | ||
# Specify an external helper to be called when a username | ||
# or password credential is needed (MAC only) | ||
git config --local credential.helper osxkeychain | ||
################ Part 3 ################ | ||
# Remove local aliases which contain Elegant Git commands | ||
git config --local --unset <alias> | ||
# Add aliases for current commands | ||
git config --local alias.<command> "elegant <command>" | ||
\`\`\` | ||
MESSAGE | ||
} | ||
|
||
__ask_question() { | ||
# usage: __ask_options <prefix> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,32 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
command-purpose() { | ||
cat <<MESSAGE | ||
Clones a repository and configures it. | ||
MESSAGE | ||
} | ||
|
||
command-synopsis() { | ||
cat <<MESSAGE | ||
usage: git elegant clone-repository <repository> | ||
MESSAGE | ||
} | ||
|
||
command-description() { | ||
cat<<MESSAGE | ||
Clones a repository into a new directory and runs its configuration. | ||
Approximate commands flow is | ||
\`\`\`bash | ||
==> git elegant clone-repository [email protected]:bees-hive/elegant-git.git | ||
git clone [email protected]:bees-hive/elegant-git.git | ||
cd elegant-git | ||
git elegant acquire-repository | ||
\`\`\` | ||
MESSAGE | ||
} | ||
|
||
default() { | ||
_error-if-empty "$1" "Cloneable URL is not set." | ||
boxtee git clone "$1" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.