-
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.
The command aims to show all available personal and common workflows for the repository. Adding of the command encourages to change the layout of the main help message. The updated help groups the commands based on their purposes rather than by the type of objects they interact with. Also, for the optimization of further development, the `workflows` plugin is introduced. It serves all workflows-specific common logic.
- Loading branch information
Showing
9 changed files
with
165 additions
and
29 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
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env bash | ||
|
||
command-purpose() { | ||
cat <<MESSAGE | ||
Shows configured workflows in the repository. | ||
MESSAGE | ||
} | ||
|
||
command-synopsis() { | ||
cat <<MESSAGE | ||
usage: git elegant show-workflows | ||
MESSAGE | ||
} | ||
|
||
command-description() { | ||
cat<<MESSAGE | ||
Shows all personal and common workflows files that are available in the | ||
repository. | ||
Personal workflows are located in \`.git/.workflows\` directory and common ones | ||
are in \'.workflows\` relatively to the repository root directory. | ||
Approximate command's output is | ||
\`\`\`bash | ||
==>> git elegant show-workflows | ||
.git/.workflows/accept-work-after | ||
.workflows/amend-work-ahead | ||
.workflows/amend-work-after | ||
.workflows/release-work-after | ||
.workflows/save-work-ahead | ||
.workflows/save-work-after | ||
.... | ||
\`\`\` | ||
MESSAGE | ||
} | ||
|
||
--list() { | ||
if test -e "${1}" ; then | ||
echo "${1}" | ||
fi | ||
} | ||
|
||
default() { | ||
for command in $(git elegant show-commands); do | ||
--list $(personal-workflows-file ${command} ahead) | ||
--list $(personal-workflows-file ${command} after) | ||
--list $(common-workflows-file ${command} ahead) | ||
--list $(common-workflows-file ${command} after) | ||
done | ||
} |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
--prefix(){ | ||
if [[ ! "init-repository clone-repository" =~ ${1} ]]; then | ||
git rev-parse --show-cdup 2>/dev/null | ||
fi | ||
} | ||
|
||
personal-workflows() { | ||
# usage: personal-workflows <command> | ||
echo "$(--prefix ${1}).git/.workflows" | ||
} | ||
|
||
common-workflows() { | ||
# usage: common-workflows <command> | ||
echo "$(--prefix ${1}).workflows" | ||
} | ||
|
||
personal-workflows-file() { | ||
# usage: personal-workflows-file <comand> <type> | ||
echo "$(personal-workflows ${1})/${1}-${2}" | ||
} | ||
|
||
common-workflows-file() { | ||
# usage: common-workflows-file <comand> <type> | ||
echo "$(common-workflows ${1})/${1}-${2}" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bats | ||
|
||
load addons-common | ||
load addons-repo | ||
|
||
setup() { | ||
repo-new | ||
} | ||
|
||
teardown(){ | ||
repo-clean | ||
} | ||
|
||
@test "'show-workflows': displays all available workflow files" { | ||
repo "mkdir -p .workflows .git/.workflows" | ||
repo "echo echo ahead git > .git/.workflows/start-work-ahead" | ||
repo "echo echo ahead no > .workflows/start-work-ahead" | ||
repo "echo echo after git > .git/.workflows/start-work-after" | ||
repo "echo echo after no > .workflows/start-work-after" | ||
repo "ls -lah .git/.workflows/* .workflows/*" | ||
check git-elegant show-workflows | ||
[[ ${status} -eq 0 ]] | ||
[[ ${lines[0]} =~ ".git/.workflows/start-work-ahead" ]] | ||
[[ ${lines[1]} =~ ".git/.workflows/start-work-after" ]] | ||
[[ ${lines[2]} =~ ".workflows/start-work-ahead" ]] | ||
[[ ${lines[3]} =~ ".workflows/start-work-after" ]] | ||
} |