Fossil: Check-in [c519d8b754]

Fossil SCM

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix the completion for e.g. fossil uv command
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | zsh-completion
Files: files | file ages | folders
SHA3-256:c519d8b7540b7132a9099ae133cb9e5c269d92237169806d783bfb17907f7110
User & Date: milouse 2018-12-04 16:43:10
Context
2018-12-05
09:01
Follow zsh guidelines for autocompletion script (https://github.com/zsh-users/zsh/blob/master/Etc/completion-style-guide)) check-in: 5d66314586 user: milouse tags: zsh-completion
2018-12-04
16:43
Fix the completion for e.g. fossil uv command check-in: c519d8b754 user: milouse tags: zsh-completion
2018-11-22
09:42
Add description at the top of the zsh autocomplete script check-in: 5b7ac948d7 user: milouse tags: zsh-completion
Changes

Changes to tools/fossil-autocomplete.zsh.

60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
..
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
        commands)
            __fossil_commands
            ;;
        args)
            local -a opts
            help_word=$words[2]
            [ "$help_word" = 'all' ] && help_word=$words[3]
            fossil help $help_word | sed -n '/^  *\(-[a-zA-Z]|\)\?--[a-z-]* .*$/{
                h # Keep pattern on hold
                :loop
                n # Advance one line
                /^  *\(-[a-zA-Z]|\)\?--[a-z-]* .*$/{
                    b print
                }
                /^$/{
                    b loop
                }
                /^[^ ]/{
                    b print
................................................................................
                H # hold += nl + pattern
                b loop # Go to loop
                :print
                x # Swap hold/pattern
                /^  */!q
                s/\n */ /g # Replace nl by space characters
                # Then extract usefull values
                s/^ *\(\(-[a-zA-Z]|\)\?--[a-z-]*\) \([A-Z:-]*\)\? *\(.*\)$/\1:\4/
                s/^\(.*\)|\(.*\):\(.*\)$/\1:\3\n\2:\3/ # Format short flags
                p # Print pattern
                b loop # Go to loop
            }' | while read line; do
                opts+="$line"
            done
            _describe 'options' opts && ret=0







|



|







 







|







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
..
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
        commands)
            __fossil_commands
            ;;
        args)
            local -a opts
            help_word=$words[2]
            [ "$help_word" = 'all' ] && help_word=$words[3]
            fossil help $help_word | sed -n '/^ \{2,3\}\(-[a-zA-Z]|\)\?--[a-z-]* .*$/{
                h # Keep pattern on hold
                :loop
                n # Advance one line
                /^ \{2,3\}\(-[a-zA-Z]|\)\?--[a-z-]* .*$/{
                    b print
                }
                /^$/{
                    b loop
                }
                /^[^ ]/{
                    b print
................................................................................
                H # hold += nl + pattern
                b loop # Go to loop
                :print
                x # Swap hold/pattern
                /^  */!q
                s/\n */ /g # Replace nl by space characters
                # Then extract usefull values
                s/^ \{2,3\}\(\(-[a-zA-Z]|\)\?--[a-z-]*\) \([A-Z:-]*\)\? *\(.*\)$/\1:\4/
                s/^\(.*\)|\(.*\):\(.*\)$/\1:\3\n\2:\3/ # Format short flags
                p # Print pattern
                b loop # Go to loop
            }' | while read line; do
                opts+="$line"
            done
            _describe 'options' opts && ret=0