File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ _git-elegant (){
2121 'make-workflow:makes a new workflow file for the repository'
2222 'obtain-work:checkouts a remote branch matching by a name'
2323 'polish-work:reapplies branch commits interactively'
24+ 'polish-workflow:edits a given workflows file'
2425 'prune-repository:removes useless local branches'
2526 'release-work:releases available work as a new annotated tag'
2627 'save-work:commits current modifications'
@@ -67,6 +68,10 @@ __ge_complete_commands () {
6768 show-release-notes) __ge_show_release_notes ;;
6869 start-work) __ge_start_work ;;
6970 make-workflow) __ge_make_workflow ;;
71+ polish-workflow)
72+ local files=($(git elegant show-workflows))
73+ _arguments '--help' '--no-workflows' '1:file:(${files[@]})'
74+ ;;
7075 *) _arguments '--help' '--no-workflows' ;;
7176 esac
7277}
Original file line number Diff line number Diff line change @@ -44,6 +44,11 @@ _git_elegant() {
4444 show-release-notes)
4545 COMPREPLY=( $( compgen -W " simple smart ${gecops[*]} " -- ${cursor} ) )
4646 ;;
47+ polish-workflow)
48+ COMPREPLY=(
49+ $( compgen -W " ${opts[*]} $( git elegant show-workflows) " -- ${cursor} )
50+ )
51+ ;;
4752 * )
4853 COMPREPLY=( $( compgen -W " ${gecops[*]} " -- ${cursor} ) )
4954 ;;
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ There are commands used in various situations such as
2626 enhance contribution rules
2727 show-workflows Shows configured workflows in the repository.
2828 make-workflow Makes a new workflow file for the repository.
29+ polish-workflow Edits a given workflows file.
2930
3031 make day-to-day contributions
3132 start-work Creates a new branch.
@@ -262,6 +263,21 @@ Approximate commands flow is
262263git rebase --interactive @~5
263264```
264265
266+ # ` polish-workflow `
267+
268+ ``` bash
269+ usage: git elegant polish-workflow < file>
270+ ```
271+
272+ Opens a given workflow file in the default text editor. If given file is not
273+ present, the command raises an error.
274+
275+ Approximate commands flow is
276+ ``` bash
277+ ==>> git elegant polish-workflow .workflows/show-work-ahead
278+ vim .workflows/show-work-ahead
279+ ```
280+
265281# ` prune-repository `
266282
267283``` bash
Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ $(--print-command-in-usage prune-repository)
8383 enhance contribution rules
8484$( --print-command-in-usage show-workflows)
8585$( --print-command-in-usage make-workflow)
86+ $( --print-command-in-usage polish-workflow)
8687
8788 make day-to-day contributions
8889$( --print-command-in-usage start-work)
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ command-purpose () {
4+ cat << MESSAGE
5+ Edits a given workflows file.
6+ MESSAGE
7+ }
8+
9+ command-synopsis () {
10+ cat << MESSAGE
11+ usage: git elegant polish-workflow <file>
12+ MESSAGE
13+ }
14+
15+ command-description () {
16+ cat<< MESSAGE
17+ Opens a given workflow file in the default text editor. If given file is not
18+ present, the command raises an error.
19+
20+ Approximate commands flow is
21+ \`\`\` bash
22+ ==>> git elegant polish-workflow .workflows/show-work-ahead
23+ vim .workflows/show-work-ahead
24+ \`\`\`
25+ MESSAGE
26+ }
27+
28+ default () {
29+ _error-if-empty " ${1} " " Please specify a workflow file name"
30+ if test -e ${file} ; then
31+ $( git config core.editor) ${file}
32+ else
33+ error-text " The '${file} ' file does not exist."
34+ exit 43
35+ fi
36+ }
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ teardown() {
3131 " polish-work"
3232 " show-workflows"
3333 " make-workflow"
34+ " polish-workflow"
3435 )
3536 check git-elegant show-commands
3637 [[ ${# lines[@]} -eq ${# COMMANDS[@]} ]]
You can’t perform that action at this time.
0 commit comments