gitpod-io / dockerfreeze

Freeze your development environment as a Dockerfile
MIT License
12 stars 4 forks source link

Add BASH completion #45

Closed JesterOrNot closed 4 years ago

JesterOrNot commented 4 years ago

Fixes #43

JesterOrNot commented 4 years ago

@Kreyren what do you think?

Kreyren commented 4 years ago

@JesterOrNot eh? you merged a broken commit see review above.

JesterOrNot commented 4 years ago

??? It's not broken image

Kreyren commented 4 years ago

@JesterOrNot It's not broken, because you are executing it on bash even with shebang set on /bin/sh because non-POSIX systems does not do a good job replecating POSIX environment.

Current issues captured by shellcheck:


Line 3:
    local cur prev opts cmds
    ^-- SC2039: In POSIX sh, 'local' is undefined.
                        ^-- SC2034: cmds appears unused. Verify use (or export if used externally).

Line 4:
    COMREPLY=()
    ^-- SC2034: COMREPLY appears unused. Verify use (or export if used externally).
             ^-- SC2039: In POSIX sh, arrays are undefined.

Line 5:
    cur="${COMP_WORDS[COMP_CWORD]}"
         ^-- SC2039: In POSIX sh, array references are undefined.

Line 6:
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    ^-- SC2034: prev appears unused. Verify use (or export if used externally).
          ^-- SC2039: In POSIX sh, array references are undefined.

Line 8:
    if [[ ${cur} == -* ]] ; then
       ^-- SC2039: In POSIX sh, [[ ]] is undefined.

Line 9:
        COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
                  ^-- SC2039: In POSIX sh, arrays are undefined.
                    ^-- SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
                      ^-- SC2039: In POSIX sh, 'compgen' is undefined.
                                              ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: (apply this, apply all SC2086)
        COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )

Line 11:
    elif [[ ${cur} == r* ]]; then
         ^-- SC2039: In POSIX sh, [[ ]] is undefined.

Line 12:
        COMPREPLY=( $(compgen -W "${opts}" ${cur}) )
                  ^-- SC2039: In POSIX sh, arrays are undefined.
                    ^-- SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
                      ^-- SC2039: In POSIX sh, 'compgen' is undefined.
                                           ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: (apply this, apply all SC2086)
        COMPREPLY=( $(compgen -W "${opts}" "${cur}") )

Line 16:
complete -F _dockerfreeze dockerfreeze
^-- SC2039: In POSIX sh, 'complete' is undefined.

See https://shellcheck.net/?id=cb45071

Sidenote: You merged lisas after this which won't trigger because they are set to trigger on file change in merge request. image

JesterOrNot commented 4 years ago

Sorry, I'll fix it